Thursday, March 20, 2008

DPS912 Semaphores; Shared Memory: Message Ques

Semaphores

Have to do with synchronizing processes (threads have their own method of synch)
Sometimes you have to serialize the access to shared resources
Unix semaphores are known as system V Semaphores (as opposed to BSD Semaphores which are used in threads)

"protect a critical section" - any section of code which could have a race condition.

See "Critical section example from Les' notes

P - V: P = wait for resource ... V = signal when finished with resource

Shared Memory

normally different processes have completely different memory areas... but doing IPC is expensive and hard.... thus shared memory.

shared memory is much like semaphores... shared memory should use semaphores to serialize and synchronize.

Message Queues

Efficient and easy method of sending messages to unrelated processes

Message Queues, Shared Memory, and Semaphores all work similarly.

No comments: