Presentation is loading. Please wait.

Presentation is loading. Please wait.

Switching to Blackboard

Similar presentations


Presentation on theme: "Switching to Blackboard"— Presentation transcript:

1 Switching to Blackboard
All assignments will be submitted through blackboard To access, you need to do the following: Get your UNET id and set a password. Contact UNET helpdesk or the IT helpdesk if necessary. Can also call 800 number on blackboard homepage. All future homework/projects must be submitted via the digital dropbox on blackboard.

2 Proposed Schedule Modification
Reschedule preliminary 1 to Monday, October 4th. Reschedule due date for project part 1 to Wednesday October 6th.

3 Midterm READING: You are responsible for all of the material covered in the book up to (but not including) Section except for the following sections: Chapter 1: 1.2.1, 1.2.2, 1.2.4, 1.2.5, 1.3, 1.5.8, 1.7 to the end of the chapter. Chapter 2: 2.2.6, to the end of the chapter. Also responsible for all class slides!! Please make sure you review the material carefully because large pieces of it is not covered in the book.

4 Dining Philosophers (1)
Philosophers eat/think Eating needs 2 forks Pick one fork at a time How to prevent deadlock

5 A nonsolution to the dining philosophers problem

6 Solution to dining philosophers problem (part 1)

7 Solution to dining philosophers problem (part 2)

8 State Array S Array T T T T T Mutex = 1 NULL Mutex.queue P0: take_forks(0) down(mutex) ; test(0) ;

9 State Array S Array E T T T T Mutex = 0 NULL Mutex.queue P0: take_forks(0) down(mutex) ; test(0) ;

10 State Array S Array E T T T T Mutex = 0 NULL Mutex.queue P0: take_forks(0) down(mutex) ; test(0) ; up(mutex) ; down(S[0]) ;

11 State Array S Array E T T T T Mutex = 1 NULL Mutex.queue P0: take_forks(0) down(mutex) ; test(0) ; up(mutex) ; down(S[0]) ; // falls through to //critical section Preempted

12 State Array S Array E T T T T Mutex = 1 NULL Mutex.queue P0: take_forks(0) down(mutex) ; test(0) ; down(S[0]) ; Preempted P2: take_forks(2) ;

13 State Array S Array E T T T T Mutex = 0 NULL Mutex.queue P0: take_forks(0) down(mutex) ; test(0) ; down(S[0]) ; Preempted P2: take_forks(2) ;

14 State Array S Array E T T T T Mutex = 0 NULL Mutex.queue P0: take_forks(0) down(mutex) ; test(0) ; down(S[0]) ; Preempted P2: take_forks(2) ; test(2) ;

15 State Array S Array E T E T T Mutex = 0 NULL Mutex.queue P0: take_forks(0) down(mutex) ; test(0) ; down(S[0]) ; Preempted P2: take_forks(2) ; test(2) ;

16 State Array S Array E T E T T Mutex = 0 NULL Mutex.queue P0: take_forks(0) down(mutex) ; test(0) ; down(S[0]) ; Preempted P2: take_forks(2) ; test(2) ; up(mutex) ; down(S[2]) ;

17 State Array S Array E T E T T Mutex = 1 NULL Mutex.queue P0: take_forks(0) down(mutex) ; test(0) ; down(S[0]) ; Preempted P2: take_forks(2) ; test(2) ; up(mutex) ; down(S[2]) ; //falls through semaphore //and enters critical section.

18 State Array S Array E T E T T Mutex = 1 NULL Mutex.queue P0: take_forks(0) down(mutex) ; test(0) ; down(S[0]) ; Preempted P2: take_forks(2) ; test(2) ; up(mutex) ; down(S[2]) ; eat() !!! P3: take_forks(3) ; down(mutex) ; test(3) ; up(mutex) ; down(S[3]) ;

19 State Array S Array E T E H T Mutex = 1 NULL Mutex.queue S[3].queue P0: take_forks(0) down(mutex) ; test(0) ; down(S[0]) ; Preempted P2: take_forks(2) ; test(2) ; up(mutex) ; down(S[2]) ; eat() !!! P3: take_forks(3) ; down(mutex) ; test(3) ; up(mutex) ; down(S[3]) ; P3

20 State Array S Array E T E H T Mutex = 1 NULL Mutex.queue S[3].queue P0: take_forks(0) down(mutex) ; test(0) ; down(S[0]) ; Preempted P2: take_forks(2) ; test(2) ; up(mutex) ; down(S[2]) ; eat() !!! P3: take_forks(3) ; down(mutex) ; test(3) ; up(mutex) ; down(S[3]) ; P2: put_forks(2) ; set state[2] = Thinking. test(1) ; P3

21 State Array S Array E T T H T Mutex = 0 NULL Mutex.queue S[3].queue P0: take_forks(0) down(mutex) ; test(0) ; down(S[0]) ; Preempted P2: take_forks(2) ; test(2) ; up(mutex) ; down(S[2]) ; eat() !!! P3: take_forks(3) ; down(mutex) ; test(3) ; up(mutex) ; down(S[3]) ; P2: put_forks(2) ; set state[2] = Thinking. test(1) ; //left neighbor not //hungry. P3

22 State Array S Array E T T H T Mutex = 0 NULL Mutex.queue S[3].queue P0: take_forks(0) down(mutex) ; test(0) ; down(S[0]) ; Preempted P2: take_forks(2) ; test(2) ; up(mutex) ; down(S[2]) ; eat() !!! P3: take_forks(3) ; down(mutex) ; test(3) ; up(mutex) ; down(S[3]) ; P2: put_forks(2) ; set state[2] = Thinking. test(1) ; P3

23 State Array S Array E T T T T Mutex = 0 NULL Mutex.queue P0: take_forks(0) down(mutex) ; test(0) ; down(S[0]) ; Preempted P2: take_forks(2) ; test(2) ; up(mutex) ; down(S[2]) ; eat() !!! P3: take_forks(3) ; down(mutex) ; test(3) ; up(mutex) ; down(S[3]) ; P2: put_forks(2) ; set state[2] = Thinking. test(1) ; P3 Ready Queue

24 Solution to dining philosophers problem (part 2)

25 Create Deadlock down(S[x]) ; up (mutex) ;


Download ppt "Switching to Blackboard"

Similar presentations


Ads by Google