Ping-Pong with Semaphores
void
PingPong() {
while(not done) {
blue->P();
Compute();
purple->V();
}
}
void
PingPong() {
while(not done) {
purple->P();
Compute();
blue->V();
}
}
blue->Init(0);
purple->Init(1);
Previous slide
Next slide
Back to first slide
View graphic version