Monday, May 31, 2010

Semaphores, Mutex and other threading terms

A Semaphore is;
- A counter designed to restrict access to a resource to a specific count
- Typically a semaphore is using to signal the presence and count of of messages in a producer-consumer multithreaded system.

A Mutex is;
- MUTually EXclusive
- A counter with the count 1.
- Designed to allow single access to a piece of code.
- Typically used to enforce concurrent access to a re-entrant piece of code or critical region

A critical region is;
- A piece of code that cant not be executed simultaneously by 2 or more threads

An Atomic operation is;
- An operation that once execution begins is uninterruptable until it completes.
- A thread that executes such an operation doesnt need an mutex to guard it.
- The operation can be used to implement a mutex in threaded systems.

A Wait command is;
- The wait command is used to obtain a mutex or semaphore and will suspensed the thread until it

Signal command is;
- The command used to release of a single semaphore or mutex

Broadcast command is:
- A command used to release all threads waiting for a condition variable..

- The fundamental design pattern of how to communicate meaningful data from 1 tread to another.

No comments:

Post a Comment