Re: Fork/Exec vs pthread
Re: Fork/Exec vs pthread
- Subject: Re: Fork/Exec vs pthread
- From: Michael Smith <email@hidden>
- Date: Sat, 17 Mar 2007 11:49:21 -0700
On Mar 17, 2007, at 9:48 AM, Tony Scaminaci wrote:
My question relates to the difference between use of fork/exec to
launch multiple processes and the use of pthreads. What I want is a
guarantee that if the machine has 4 CPU's, all 4 will run a portion
of the overall memory tests by launching four separate test
processes with each one testing 1/4 of the available memory. I
can't find any documentation regarding the difference between
pthreads and fork/exec nor anything that states definitively that
launching X number of threads or processes will spread those
processes or threads across all X CPU's. Can someone please shed
light on this and let me know which route I should go?
There is no mechanism currently provided for strongly binding a
thread to a specific execution context. This is traditionally
something grossly abused by application developers that think that
the OS should have no part in deciding what is and isn't important.
The system reserves the right to schedule your threads as it sees
fit; that being said if the system is otherwise idle, is not being
power managed for thermal, acoustic or administrative reasons, and
you have at least one thread per execution context, you can
reasonably expect that on current systems you will run on all of them
for much of the time.
There will be *no* correlation between thread and CPU package/core,
so you're not going to be able to say "this thread detected a cache
error so this CPU is defective". There are interfaces to take CPUs
offline, however, so you may want to consider a process of
elimination in the situation where you have detected a cache error.
= Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden