Semaphores

Published on Slideshow
Static slideshow
Download PDF version
Download PDF version
Embed video
Share video
Ask about this video

Scene 1 (0s)

In 1965, Dijkstra proposed a new and very significant technique for managing concurrent processes by using the value of a simple integer variable to synchronize the progress of interacting processes. This integer variable is called semaphore. So it is basically a synchronizing tool and is accessed only through two low standard atomic operations, Wait and Signal by P(S) and V(S) respectively. In very simple words, semaphore is a variable which can hold only a non-negative Integer value, shared between all the threads, with operations wait and signal..

Scene 2 (5m 0s)

Semaphores qA semaphore is an object that consists of a counter, a waiting list of processes and two methods (e.g., fun....

Scene 3 (5m 14s)

Semaphore Method: wait void wait(sem S) { S.count--; if (S.count < 0) { ....

Scene 4 (5m 36s)

Important Note: 1/4 S.count--; S.count++; if (S.count<0) { if (S.count<=0) { add to list; ....

Scene 5 (5m 46s)

Important Note: 2/4 S.count--; S.count++; if (S.count<0) { if (S.count<=0) { add to list; ....

Scene 6 (5m 56s)

Important Note: 3/4 S.count--; S.count++; if (S.count<0) { if (S.count<=0) { add to list....

Scene 7 (6m 6s)

Important Note: 3/4 S.count--; S.count++; if (S.count<0) { if (S.count<=0) { add to list....

Scene 8 (6m 22s)

Three Typical Uses of Semaphores qThere are three typical uses of semaphores: vmutual exclusion: Mutex (i.e., Mutua....

Scene 9 (6m 32s)

Three Typical Uses of Semaphores qThere are three typical uses of semaphores: vmutual exclusion: Mutex (i.e., Mutua....

Scene 10 (6m 45s)

Use 2: Count-Down Counter semaphore S = 3; Process 1 Process 2 while (1) { ....

Scene 11 (6m 53s)

Use 3: Notification semaphore S1 = 1, S2 = 0; process 1 process 2 while (1) { while (1) { ....

Scene 12 (7m 2s)

Lock Example: Dining Philosophers § Five philosophers are in a thinking - eating cycle. § When a philosoph....