clear pic
Simulation of Dining Philosophers In this project we use the dining philosopher system as our main example. Four Chinese philosophers are sitting around a circular table. In the middle of the table there is a delicious dish of rice, and between each pair of philosophers there is a single chopstick. Each philosopher alternates between thinking/resting and eating. To eat, the philosopher needs two chopsticks, and he is only allowed to use the two which are situated next to him (on his left and right side). The sharing of chopsticks prevents two neighbors from eating at the same time. OK / The philosopher system is modelled by the CPN tools software as shown below: 10 About the system: The system is designed to use forks and knifes instead of chopsticks. PH1, PH2, PH3 and PH4 represents the philosophers. There are 8 places and 8 transitions detailed in the table below: 4 places 2 forks and 2 knifes 4 places 4 philosophers 4 transitions Eating activity for each philosopher 4 transitions Resting activity for each philosopher The network includes initialization tokens at Forkl and Knifel. The network associated with philosopher 1 (PHI) is complete. He is ready to eat. The transition "PHI Ready to Eat" is enabled (tokens at Forkl and Knifel are ready to fire). In other words, having one knife and one fork philosopher I is ready to eat. When PH1 having a state where two tokens are available, he can also rest by releasing (triggering Phi ) the fork and knife. On the other hand, the networks of the other philosophers are not complete. Tasks: a) Construct the CP-net as shown above. Make sure to use proper labeling and correct color set. b) Complete the network of other philosophers. Use philosopher I network as your guide. a. Do not add/delete places or transitions b. Provide screenshot of the diagram. c) Test the system and write your notes about the system's behavior. d) What OS problem does the model represent, and how can it be solved?? Note: At any moment in the system, maximum any two non-neighbor philosopher can either eat or rest, and the other two are resting or eating respectively. 1' "Fork" 1 "Fork" Fork 1 10 "Fork" OTRING PH1 Ready to Eat PH2 Ready to Eat 1" "Knife" ++ 1* "Fork" 1' "Fork" PH2 STRING PH1 1 "Knife" STRING 1 "Knife" ++ 1 "Fork" 1 "Knife" 1" "Knife" Knife 1 1' "Knife" PH1 Ready to Rest STRING PH2 Ready to Rest Knife 2 STRING PH4 Ready to Rest PH3 Ready to Rest PH4 PH3 STRING STRING PH3 Ready to Eat PH3 Ready to Eat Fork 2 STRING Simulation of Dining Philosophers In this project we use the dining philosopher system as our main example. Four Chinese philosophers are sitting around a circular table. In the middle of the table there is a delicious dish of rice, and between each pair of philosophers there is a single chopstick. Each philosopher alternates between thinking/resting and eating. To eat, the philosopher needs two chopsticks, and he is only allowed to use the two which are situated next to him (on his left and right side). The sharing of chopsticks prevents two neighbors from eating at the same time. OK / The philosopher system is modelled by the CPN tools software as shown below: 10 About the system: The system is designed to use forks and knifes instead of chopsticks. PH1, PH2, PH3 and PH4 represents the philosophers. There are 8 places and 8 transitions detailed in the table below: 4 places 2 forks and 2 knifes 4 places 4 philosophers 4 transitions Eating activity for each philosopher 4 transitions Resting activity for each philosopher The network includes initialization tokens at Forkl and Knifel. The network associated with philosopher 1 (PHI) is complete. He is ready to eat. The transition "PHI Ready to Eat" is enabled (tokens at Forkl and Knifel are ready to fire). In other words, having one knife and one fork philosopher I is ready to eat. When PH1 having a state where two tokens are available, he can also rest by releasing (triggering Phi ) the fork and knife. On the other hand, the networks of the other philosophers are not complete. Tasks: a) Construct the CP-net as shown above. Make sure to use proper labeling and correct color set. b) Complete the network of other philosophers. Use philosopher I network as your guide. a. Do not add/delete places or transitions b. Provide screenshot of the diagram. c) Test the system and write your notes about the system's behavior. d) What OS problem does the model represent, and how can it be solved?? Note: At any moment in the system, maximum any two non-neighbor philosopher can either eat or rest, and the other two are resting or eating respectively. 1' "Fork" 1 "Fork" Fork 1 10 "Fork" OTRING PH1 Ready to Eat PH2 Ready to Eat 1" "Knife" ++ 1* "Fork" 1' "Fork" PH2 STRING PH1 1 "Knife" STRING 1 "Knife" ++ 1 "Fork" 1 "Knife" 1" "Knife" Knife 1 1' "Knife" PH1 Ready to Rest STRING PH2 Ready to Rest Knife 2 STRING PH4 Ready to Rest PH3 Ready to Rest PH4 PH3 STRING STRING PH3 Ready to Eat PH3 Ready to Eat Fork 2 STRING