Subj : Re: Diff b/w Events, Semaphores and mutex To : comp.programming.threads From : David Schwartz Date : Sun Apr 24 2005 01:19 pm "Gurikar" wrote in message news:1114342501.025019.217020@l41g2000cwc.googlegroups.com... > Can anyone tell me whats the difference b/w semaphores, events and > mutexes. I dont know when to use what? Please help me. Here's the short version: Semaphores: A number. You can increase the number, decrease the number, or do a "wait and decrement" operation. They can be used to ensure that no more than a particular number of threads (which can be one) can access a particular resource. Events: A thing that you can wait for. Threads can signal the event, waking up any threads that are waiting for the event. Some events can be in an 'open' or 'closed' state while other events are stateless and an 'open' operation only unblocks threads waiting for the event at that instant. Some support a 'realease one' operation that only unblocks a single thread (rather than all the threads waiting for that event). Mutex: A lock that only one thread can hold. These are used to ensure that only a single thread accesses a shared object at a time. DS .