Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5. The distracted dentist problem: imagine a dentist office with a single chair and a waiting room with a number of chairs in it. When

5. The distracted dentist problem: imagine a dentist office with a single chair and a waiting room with a number of chairs in it. When the dentist finishes an appointment, the dentist checks on a video monitor if there are any patients in the waiting room. If there are, one patient is invited to sit in the chair for an appointment. If there are no other patients waiting, the dentist sits in the chair and starts texting.

When patients arrive, they look to see what the dentist is doing. If the dentist is texting, the customer rouses the dentist and sits in the chair for the appointment. If the dentist is busy, the patient goes to the waiting room to find a free chair. If there is no free chair, the patient leaves the office. All the actions take an unknown amount of time.

This situation can lead to problems. For example, a patient may find the dentist busy and proceed to the waiting room, but before the patient gets a waiting room chair, the dentist might complete the current appointment and upon seeing on the monitor no one is sitting, decide to start texting. While the patient will eventually sit down, the dentist wont notice someone is waiting. Its also possible that when the dentist is busy, there is one waiting room chair available and two recently arrived patients might attempt to sit in the same chair.

// I Am re-posting this question, I did not specify that the semaphores and pseudo-code need to be written in the C language

a) Provide a description of what semaphores and system state you would define to create a deadlockfree solution

b) Provide pseudo-code for the dentist

c) Provide pseudo-code for a patient

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions