Title: Switching to Blackboard
1Switching 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.
- http//www.courses.maine.edu/
- All future homework/projects must be submitted
via the digital dropbox on blackboard.
2Proposed Schedule Modification
- Reschedule preliminary 1 to Monday, October 4th.
- Reschedule due date for project part 1 to
Wednesday October 6th.
3Midterm
- READING
- You are responsible for all of the material
covered in the book - up to (but not including) Section 2.3.7
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, 2.3.7 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.
4Dining Philosophers (1)
- Philosophers eat/think
- Eating needs 2 forks
- Pick one fork at a time
- How to prevent deadlock
5Dining Philosophers
- A nonsolution to the dining philosophers problem
6Dining Philosophers
- Solution to dining philosophers problem (part 1)
7Dining Philosophers
- Solution to dining philosophers problem (part 2)
8 T T T T
T
State Array S Array
Mutex 1
NULL
Mutex.queue
P0 take_forks(0) down(mutex)
test(0)
9 E T T T
T
State Array S Array
Mutex 0
NULL
2 1 1 1
1
Mutex.queue
P0 take_forks(0) down(mutex)
test(0)
10 E T T T
T
State Array S Array
Mutex 0
NULL
1 0 0 0
0
Mutex.queue
P0 take_forks(0) down(mutex)
test(0) up(mutex) down(S0)
11 E T T T
T
State Array S Array
Mutex 1
NULL
Mutex.queue
P0 take_forks(0) down(mutex)
test(0) up(mutex) down(S0)
// falls through to //critical
section Preempted
12 E T T T
T
State Array S Array
Mutex 1
NULL
1 1 1 1
1
Mutex.queue
P0 take_forks(0) down(mutex)
test(0) down(S0) Preempted P2
take_forks(2) down(mutex)
13 E T T T
T
State Array S Array
Mutex 0
NULL
1 1 1 1
1
Mutex.queue
P0 take_forks(0) down(mutex)
test(0) down(S0) Preempted P2
take_forks(2) down(mutex)
14 E T E T
T
State Array S Array
Mutex 0
NULL
1 1 2 1
1
Mutex.queue
P0 take_forks(0) down(mutex)
test(0) down(S0) Preempted P2
take_forks(2) down(mutex) test(2)
15 E T T T
T
State Array S Array
Mutex 0
NULL
1 1 1 1
1
Mutex.queue
P0 take_forks(0) down(mutex)
test(0) down(S0) Preempted P2
take_forks(2) down(mutex) test(2)
16 E T E T
T
State Array S Array
Mutex 0
NULL
1 1 2 1
1
Mutex.queue
P0 take_forks(0) down(mutex)
test(0) down(S0) Preempted P2
take_forks(2) down(mutex) test(2)
up(mutex) down(S2)
17 E T E T
T
State Array S Array
Mutex 1
NULL
1 1 1 1
1
Mutex.queue
P0 take_forks(0) down(mutex)
test(0) down(S0) Preempted P2
take_forks(2) down(mutex) test(2)
up(mutex) down(S2) //falls
through semaphore //and enters critical
section.
18 E T E T
T
State Array S Array
Mutex 1
NULL
1 1 1 1
1
Mutex.queue
P0 take_forks(0) down(mutex)
test(0) down(S0) Preempted P2
take_forks(2) down(mutex) test(2)
up(mutex) down(S2) eat()
!!!
P3 take_forks(3) down(mutex) test(3)
up(mutex) down(S3)
19 E T E H
T
State Array S Array
Mutex 1
NULL
1 1 1 0
1
Mutex.queue
S3.queue
P0 take_forks(0) down(mutex)
test(0) down(S0) Preempted P2
take_forks(2) down(mutex) test(2)
up(mutex) down(S2) eat()
!!!
P3 take_forks(3) down(mutex) test(3)
up(mutex) down(S3)
P3
20 E T E H
T
State Array S Array
Mutex 1
NULL
1 1 1 0
1
Mutex.queue
S3.queue
P0 take_forks(0) down(mutex)
test(0) down(S0) Preempted P2
take_forks(2) down(mutex) test(2)
up(mutex) down(S2) eat()
!!!
P3 take_forks(3) down(mutex) test(3)
up(mutex) down(S3) P2
put_forks(2) down(mutex)
set state2 Thinking.
test(1)
P3
21 E T T H
T
State Array S Array
Mutex 0
NULL
1 1 1 0
1
Mutex.queue
S3.queue
P0 take_forks(0) down(mutex)
test(0) down(S0) Preempted P2
take_forks(2) down(mutex) test(2)
up(mutex) down(S2) eat()
!!!
P3 take_forks(3) down(mutex) test(3)
up(mutex) down(S3) P2
put_forks(2) down(mutex)
set state2 Thinking.
test(1) //left neighbor not //hungry.
P3
22 E T T H
T
State Array S Array
Mutex 0
NULL
1 1 1 0
1
Mutex.queue
S3.queue
P0 take_forks(0) down(mutex)
test(0) down(S0) Preempted P2
take_forks(2) down(mutex) test(2)
up(mutex) down(S2) eat()
!!!
P3 take_forks(3) down(mutex) test(3)
up(mutex) down(S3) P2
put_forks(2) down(mutex)
set state2 Thinking.
test(1) test(3)
P3
23 E T T T
T
State Array S Array
Mutex 0
NULL
1 1 1 1
1
Mutex.queue
P0 take_forks(0) down(mutex)
test(0) down(S0) Preempted P2
take_forks(2) down(mutex) test(2)
up(mutex) down(S2) eat()
!!!
P3 take_forks(3) down(mutex) test(3)
up(mutex) down(S3) P2
put_forks(2) down(mutex)
set state2 Thinking.
test(1) test(3)
24Dining Philosophers
- Solution to dining philosophers problem (part 2)
25Create Deadlock
down(Sx) up (mutex)