Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

help! c (not c++) programming practice problem. For this task, you will implement another solution to the Dining Philosophers problem. This solution will use semaphores

help! c (not c++) programming practice problem.

For this task, you will implement another solution to the Dining Philosophers problem. This solution will use semaphores as oppose to busy waiting loops for synchronization control. The only busy waiting loops to be used are the ones that allow a philosopher to eat and think for random amounts of time.

Procedure

As this task uses semaphores instead of busy waiting loops, you will need to represent the chopsticks as an array of semaphores instead of an array of Booleans.

  1. Sit down at table.
  2. Pick up left chopstick.
  3. Pick up right chopstick.
  4. Begin eating.
  5. Continue eating for 2-7 cycles.
  6. Put down left chopstick.
  7. Put down right chopstick.
  8. Begin thinking.
  9. Continue thinking for 3-6 cycles.
  10. IF all meals have not been eaten, GOTO 2.
  11. ELSE leave the table.

Note: Using busy waiting loops for any part of this task, apart from a philosopher eating or thinking for a random amount of time, is not allowed.

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

Recommended Textbook for

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago