A fast food restaurant has four kinds of employees: (1) order takers, who take c
ID: 3563736 • Letter: A
Question
A fast food restaurant has four kinds of employees: (1) order takers, who take customers' orders; (2) cooks, who prepare the food; (3) packaging specialists, who stuff the food into bags; and (4) cashiers, who give the bags to customers and take their money. Each employee can be regarded as a communicating sequential process. Write a complete program in code or pseudocode using 1. semaphores, 2. monitors, 3. message-passing. Is your solution deadlock-free and fair, or only deadlock-free? Justify your answer.
Explanation / Answer
Both direct communication(send(P,message),receive(id,message)) and indiect communication(send(A,message),receive(A,message)) can be used in the interprocess communication. Related UNIX processes(system calls):
simplest communication: using pipes
direct communication related system calls: msgget(), msgctl(),msgsnd() and msgrcv();
indirect commnunication related system calls: shmget();shmat();shmdt();shmctl();
Semorphore related: semget();semctl();semop()
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.