320 likes | 523 Views
Barrier. Kevin O’Gorman CS 170 22 April 2002. Barrier. 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal(). 3. 2. 1. count = 3. mutex = 1. turnstile = 0. Barrier. 1 mutex.wait()
E N D
Barrier Kevin O’Gorman CS 170 22 April 2002
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 2 1 count = 3 mutex = 1 turnstile = 0
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 2 1 count = 3 mutex = 1 turnstile = 0
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 2 1 count = 3 mutex = 0 turnstile = 0
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 2 count = 2 1 mutex = 0 turnstile = 0
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 2 count = 2 mutex = 1 1 turnstile = 0
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 2 count = 2 mutex = 1 turnstile = 0 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 2 count = 2 mutex = 1 turnstile = -1 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 2 count = 2 mutex = 1 turnstile = -1 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 2 count = 2 mutex = 0 turnstile = -1 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 count = 1 2 mutex = 0 turnstile = -1 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 count = 1 mutex = 1 2 turnstile = -1 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 count = 1 mutex = 1 turnstile = -1 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 count = 1 mutex = 1 turnstile = -2 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 count = 1 mutex = 1 turnstile = -2 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() 3 count = 1 mutex = 0 turnstile = -2 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 3 mutex = 0 turnstile = -2 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 mutex = 1 3 turnstile = -2 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 mutex = 1 turnstile = -2 3 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 mutex = 1 turnstile = -1 3 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 mutex = 1 turnstile = -2 3 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 mutex = 1 turnstile = -2 3 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 mutex = 1 turnstile = -1 3 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 mutex = 1 turnstile = -1 3 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 mutex = 1 turnstile = -1 3 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 mutex = 1 turnstile = 0 3 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 mutex = 1 turnstile = 0 3 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 mutex = 1 turnstile = 0 3 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 mutex = 1 turnstile = 1 3 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 mutex = 1 turnstile = 1 3 2 1
Barrier 1 mutex.wait() 2 count -- 3 mutex.signal() 4 if count == 0: 5 turnstile.signal() 6 turnstile.wait() 7 turnstile.signal() count = 0 mutex = 1 turnstile = 1 Success!! 3 2 1