[uClinux-dev] Threading and synchronization questions

Michael Schnell mschnell at lumino.de
Fri Feb 27 04:02:49 EST 2009


> 4) Can pthread mutexes be used across vfork/exec sub-processes?
> In documentation to pthreads they say that the pthread_mutex can be 
> used to synchronize threads but not processes. But I see no difference 
> between thread and process in uClinux. What am I missing?
To do threads you should use the pthread library. So you don't bother 
about (v)fork-ing the threads. pthreadlib also provides the thread-mutex 
methods and supposedly will use FUTEX (fast user space Mutex) instead of 
mutex, which is a lot faster if the architecture provides appropriate 
support.

You will manually use (v)fork and *exec only to spawn an independent 
process (which you need to consider having a separate address space that 
can't be accessed by the parent process).

-Michael



More information about the uClinux-dev mailing list