Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help with pseudo codes for this problem plz! Part II (7 points 3.5 points per problem): After our discussion on Deadlocks, we want to

need help with pseudo codes for this problem plz!
image text in transcribed
Part II (7 points 3.5 points per problem): After our discussion on Deadlocks, we want to check some classical problems. For each of the following problems: Step I: Think of a pseudo-code on how you can solve such a problem using one of the synchronization techniques (e.g. locks, semaphores). Step 2: Do some search on the intemet on how such a problem was solved and then adjust/update your pseudocode accordingly - use your own words to develop the pseudo-code. Step 3. Add your clarifying comments on the final pseudo-code explaining the logic/steps and the variables in detail. "Doing onlineloffline research to understand any topic is an axsential task-you must not copy; you should learn from the different external resources and develop-based on what you learned-an an swer by yourself Problem 1: Sleeping Barber ( 3.5 points) The Sleeping barber is a classical synchronization problem. There is one barber in the barbershop, one barber chair, and n chairs available for waiting customers. If there are no customers, the barber sits down in the barber chair and takes a nap. An arriving customer must first wake the barber, and the customer takes the barber chair. Subsequent arriving customer takes a waiting chair if any is empty or leaves if all chairs are full. In this case, we are synchronizing the barber and customers. Problem 2: Dining Philosophers (3.5 points) The Dining Philosophers is a classic synchronization problem. There is a circular table with five plates and between each plate, there is a single chopstick (fork). In the middle of the table, there is a bowl of delicious spaghetti. There are five philosophers who spend most of their time thinking, but also get hungry and need to eat for some time to think more. A philosopher must pick up the two chopsticks to the left and right of his plate in order to eat. Philosophers may pick up and put down their chopsticks in either order, where two philosophers cannot use a single chopstick at the same time. Dining table with plates and forks

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Health And Safety Environment And Quality Audits A Risk-based Approach

Authors: Stephen Asbury

2nd Edition

0415508118, 978-0415508117

More Books

Students also viewed these Accounting questions