Would Mac OS X be able to distribute processes to the various cores in an Intel i7 Quad Core processor even if the applications are not multi-threaded?
A thread is what the OS sees and what it schedules on a core to run.
Programs can be single-threaded or multi-threaded. Programs can also spawn other programs and communicate with them via process-level I/O techniques like pipes or file handles, etc. But from the OS' perspective these sub-programs are still just collections of threads. It doesn't really matter if the program is spawning multiple threads or if it's spawning sub-processes -- both approaches represent OS-level threads that the OS will attempt to schedule and execute as efficiently as possible and possibly in parallel.
If you have multiple cores and a program's threads aren't being explicitly locked to a core, then the OS can try run them at the same time, in parallel, across all the cores it has available to it in the current machine. If you have multiple programs running, the OS will schedule all those underlying threads across all the cores it has available to it in the current machine.
Practically speaking there's some amount of I/O, inter-process or inter-thread communication and synchronization that needs to occur and this can cause OS-level threads to block and keep things from running truly parallel all the time. For example: two threads in a multi-threaded program might be pulling values off a shared stack to do some work, so access to the stack has to be co-ordinated to ensure everything is thread safe and that means only one thread can pop from the stack data structure at time. There's a bottleneck in the program's design that's limiting thread parallelism to one here and the OS can't help with that.
The same is true for programs that spawn sub-processes. There may be I/O or inter-process synchronization issues that prevent all spawned sub-processes from truly running in parallel all the time.
If the application itself is not multithreaded then it will stay to a single core. If you have a number of single threaded applications that are running it's reasonable to assume OS X will distribute them between he cores appropriately.
|show 3 more comments|