Hello everyone, i know this might might not be a web dev question but anyone with an idea should help me out. Is this a starvation scenario or deadlock?
At Papaye fast-food joint, on entry, customers take a number to be served. The salespersons press buttons to increment numbers on the wall as they attend to each customer. Assuming on entry, you picked number 40. Counter 1 is serving customer #38 and counter 2 is serving customer #39. The sign on the wall says, “Now Serving #39” and you’re ready with your order. Counter 2 finishes with customer #39 and presses the button so the sign says, “Now Serving #40.” But just then the clerk at counter 2 is called to the telephone and leaves the counter, never to return (an interrupt). Meanwhile, counter 1 presses the button and proceeds to serve #41 — and you’ve missed your turn. Counter 1 continues to serve #42, #43, and so on, thinking that counter 2 has attended to you.
a. In the computer system, what is the term given to this scenario?
I edited for readability.
I believe that this is a starvation because the interrupt specified that the clerk at counter 2 never returns. This is sort of like how when a process hogs part of the cpu rendering it inaccessible for other processes.
Whereas deadlock can be thought of as the stale mate of the OS: it arises when some processes are waiting for an event to happen that can only happen if they have finished waiting.
Key to the fact that it is a starvation situation is the clue given by the fact that the clerk “never returns” . If they were to return (meaning the interrupt had finished ) they would exit the interrupt, take the first task placed on top of their stack (in this case servicing the different numbers) and resume with their rams (ie, continue from number 40).
I am just reading a book about OSs, it is aimed at beginners and covers a lot of relevant stuff even if it was written 20 years ago. It is free and only 140 pages long. I can highly recommend it! I am studying python but wanted to learn the basics of OSs just to be more well rounded with the knowledge and this book really helped me:
Thank you very much for the explanation.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.