homework7_胡成一_2018329621049 Version 0 |
|
👤 Author: by 450766287qqcom 2020-12-08 06:23:48 |
after class, the stairs is vary crowded.
a.
The four necessary conditions for a deadlock are
(1) mutual exclusion: mutual exclusion condition holds as only one person can occupy a space in the stairs.
(2) hold-and-wait: hold-and-wait occurs where a person holds onto their place in the stairs while they wait to advance in the stairs.
(3) no preemption: a person cannot be removed from his/her position in the stairs
(4) circular wait: circular wait as each person is waiting for a subsequent person to advance.
b.
A simple rule that would avoid this traffic deadlock is that a person may not advance into a stairs if it is clear they will not be able to immediately clear the stairs.