Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Operating System: The local Laundromat has just entered the computer age. As each customer enters, he or she puts coins into slot at one of

Operating System:

The local Laundromat has just entered the computer age. As each customer enters, he or she puts coins into slot at one of two stations and type in the number of washing machines he/she will need. The stations are connected to a central computer that automatically assigns available machines and outputs tokens that identify the machines to be used. The customer puts laundry into the machines and inserts each token into the machine indicated on the token. When a machine finishes its cycle, it informs the computer that it is available again. The computer maintains a Boolean array available[NMACHINES] to represent if corresponding machines are available (NMACHINES is a constant indicating how many machines there are in the Laundromat), and a semaphore nfree that indicates how many machines are available. The code to allocate and release machines is as follows.

The available array is initialized to all true, and nfree is initialized to NMACHINES.

image text in transcribed

int allocate () /*Returns index of available machine */ { wait(nfree); /*Wait until a machine is available */ for hint i=0; i

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago