1 / 9

Concurrent Object-Oriented Programming Prof. Dr. Bertrand Meyer

Concurrent Object-Oriented Programming Prof. Dr. Bertrand Meyer. Exercise Session 3: Introduction. Overview. solutions Prisoners: Synchronization Safety vs. Liveness Amdahl’s Law. Prisoners: Synchronization. I will do nothing. toggle the light switch.

cassia
Télécharger la présentation

Concurrent Object-Oriented Programming Prof. Dr. Bertrand Meyer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Concurrent Object-Oriented ProgrammingProf. Dr. Bertrand Meyer Exercise Session 3: Introduction

  2. Overview • solutions • Prisoners: Synchronization • Safety vs. Liveness • Amdahl’s Law

  3. Prisoners: Synchronization • I will • do nothing. • toggle the light switch. • announce that all prisoners have been interrogated.

  4. Prisoners: Synchronization: Light Off • One of the prisoners gets selected as the counter. • All non-counting prisoners follow the following protocol. • The first time they enter the room when the light is off, they turn it on. • On all other occasions, they do nothing. • The counter follows a different protocol. • The first n − 2 times that the light is on when he enters the room, he turns it off. • The next time he enters the room when the light is on, he (truthfully) announces that everybody has been interrogated.

  5. Prisoners: Synchronization: Light Unknown • One of the prisoners gets selected as the counter. • All non-counting prisoners follow the following protocol. • The first two times they enter the room when the light is off, they turn it on. • On all other occasions, they do nothing. • The counter follows a different protocol. • The first 2n − 3 times that the light is on when he enters the room, he turns it off. • Then the next time he enters the room when the light is on, he (truthfully) announces that everybody has been interrogated.

  6. Safety vs. Liveness • safety: Nothing bad happens ever. • liveness: Something good happens eventually.

  7. Safety vs. Liveness • Patrons are served in the order they arrive. • What goes up must come down. • If two or more processes are waiting to enter their critical sections, at least one succeeds. • If an interrupt occurs, then a message is printed within one second. • If an interrupt occurs, then a message is printed. • The cost of living never decreases. • Two things are certain: death and taxes. • You can always tell a Harvard man. safety liveness liveness safety liveness safety liveness safety

  8. Amdahl’s Law

  9. Dining Philosophers: Synchronization

More Related