Hi,
Mutex and semaphores does not ensure synchronization of threads in terms of
order of execution. Mutexes (Mutual exclusion locks) prevent multiple
threads from simultaneously executing critical sections of code which access
shared data. Semaphores are similar to mutexes and can be considered as
multiple mutex which also do not guarantee/control the order of execution of
threads. As I stated earlier you should use "conditional variables along
with mutexes" to solve this problem. This is the only way to achieve
ordering of threads if you are using pthreads. 

Regards
Prabhat

-----Original Message-----
From: Raja Guha [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 17, 2002 4:49 PM
To: multiple recipients of
Subject: Re: [ilugd]: order of execution of threads


On Mon, 2002-12-16 at 13:15, Lalit Kumar Bhasin wrote:
> Hi,
>  
>  Using Linux threads / pthreads, is there any way of controlling the order
of thread execution.
>  Suppose u have T1,T2,T3. The order should be (say),
> 
> T1T2T1T2T1T2T3T1T2T1T2T1T2T1T2T3......
> 
> Dont tell me thru the 'condition' variable, as it does not controls the
order, which is the prerogative of the scheduler.
> 

Use locks such as mutexes or semaphores

          ================================================
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in
subject header. Check archives at
http://www.mail-archive.com/ilugd%40wpaa.org

          ================================================
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject 
header. Check archives at http://www.mail-archive.com/ilugd%40wpaa.org

Reply via email to