If you spawn a child process in ruby (using Kernel.system for example), can it use a different CPU to the parent process?
If so, can you use multiple threads (within the same CPU) in a parent process, and have each thread spawning a child process that can use a different CPU, even in ruby 1.8?
(Background -- it's superscript.rb from this superuser question, but rather than doing all 50 folders, I just want to do one of the folders quickly. I'm using Ubuntu Linux.)
Ruby processes are no different from any other process - they are scheduled by the OS independently, and may be distributed across CPUs according to the OS's whims.
C/Ruby 1.8 threads, on the other hand, are "green" threads, which the OS knows nothing about. All threads in a given Ruby process will be run on the same CPU. However, you can use threads to manage subprocesses, and those subprocesses may be scheduled across CPUs.