Computer Science Notes

Notes From CS Undergrad Courses FSU

This project is maintained by awa03

Semaphors

Standard Synchronization Problems

Flying Pigeon Problem

semaphore flyingPath=1; // scheduling
P(flyingPath);
// sending message
V(flyingPath);

Multi Pigeon

semaphore flyingPath= 1;
P(flyingPath);
// send the message
V(flyingPath);

/* ------------------------------------------------ */

int BirdsInTransit = 0;
++BirdsInTransit;

if(BirdsInTransit == 1){
    P(flyingPath);
}

// sends message

--BirdsInTransit;
if(BirdInTransit == 0){
    V(flyingPath);
}

Definitions