1 / 16

Mutex

Mutex. Kevin O’Gorman CS 170 22 April 2002. Mutex. A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement. B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal()

xena
Download Presentation

Mutex

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. Mutex Kevin O’Gorman CS 170 22 April 2002

  2. Mutex A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal() B5 statement balance = 1000 mutex = 1

  3. Mutex A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal() B5 statement balance = 1000 mutex = 1

  4. Mutex A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal() B5 statement balance = 1000 mutex = 0

  5. Mutex A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal() B5 statement balance = 800 mutex = 0

  6. Mutex A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal() B5 statement balance = 800 mutex = 0

  7. Mutex A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal() B5 statement balance = 800 mutex = -1

  8. Mutex A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal() B5 statement balance = 800 mutex = -1

  9. Mutex A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal() B5 statement balance = 800 mutex = 0

  10. Mutex A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal() B5 statement balance = 800 mutex = 0

  11. Mutex A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal() B5 statement balance = 800 mutex = 0

  12. Mutex A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal() B5 statement balance = 600 mutex = 0

  13. Mutex A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal() B5 statement balance = 600 mutex = 1

  14. Mutex A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal() B5 statement balance = 600 mutex = 1

  15. Mutex A1 statement A2 mutex.wait() A3 wolski.balance = wolski balance - 200 A4 mutex.signal() A5 statement B1 statement B2 mutex.wait() B3 wolski.balance = wolski balance - 200 B4 mutex.signal() B5 statement balance = 600 Success!!

More Related