(Five Users - DOIO – Two Device drivers – Two Disks) 1.- In this assignment you will...

80.2K

Verified Solution

Question

Programming

(Five Users - DOIO – Two Device drivers – TwoDisks)

1.- In this assignment you will implement a simulation of theinteraction of user programs with the OS to execute an I/Ooperation on two different devices.

User programs:

User programs will communicate withDOIO (OS) to request an I/O operation. (This willsimulate a system call)

User programs will give to DOIO threeparameters: User id, device number (dev is arandom number in the range 1 and 2 that representsdevice one or device two) and an address (addr isa random number in the range 1 and 20.) (addr isan integer that represents a track number in the hard drive).

User programs will pass the parameters to DOIO through threebuffers of size one each (bufid,bufdev, and bufaddr).

Once the parameters are stored in the buffers, user programsexecutes a p(request_served[ “index” ]) operation to wait for thecompletion of the I/O operation. You will need a semaphore arrayrequest_served[id].

There will be four users running concurrently and each willexecute 4 I/O operations.

DOIO:

DOIO will collect and id,device(dev), and address(addr)from bufid, bufdev, andbufaddr to assemble the IORB.

DOIO will check on device number to decidewhich one of the two devices will get the IORB.

Once the device has been selected, DOIO willstore the IORB (id and addr) intothe two buffers that represent the IORQ (iorqidand iorqaddr) of the selected device. Notice thatyou need separate buffers (one for each device:iorqid and iorqaddr and iorqid2and iorqaddr2). IORQ sizefour.

DOIO must wait to receive signals fromDevice drivers indicating that all request havebeen served. Then DOIO will shut down bothDisks.

Device drivers (1 and 2):

Device drivers will collect an IORB (made up ofid and addr) fromiorqid and iorqaddr (or iorqid2and iorqaddr2) and then initiate the physical I/Ooperation on the hard drive it controls and wait for the I/Ooperation to be completed:p(operation_complete).

The device driver initiates the physical I/O operation bystoring addr into a buffer of length one. Thebuffer name is “pio” (physical I/O).

When the I/O operation completes a signal is received, theDevice driver will identify theUser that issued the I/O request using theid, and will signal the semaphore“request_served[id]” associated to theUser.

When the last request has been served, both drivers have tosignal DOIO to indicate that all requests have been handled andboth drivers will emit a message: “Driver 1 (2) stops”

Disk (1 and 2):

The Disk processes simulates the access to atrack in the hard drive.

The Disk process gets the addrfrom pio and stores it in a variable called“seek” and iterates in a dummy loop from 1 to“seek”.

Once out of the loop, disk will execute a v on the semaphore“operation_complete”

Disk will operate continuously until DOIO shutsthem down.

Note:

  1. Define all semaphores that you need according to the number ofbuffers used.
  2. Each user will make 5 system calls to initiate I/Ooperations
  3. DOIO will create 20 IORB
  4. The sum of the I/O operations executed by drivers must add up20. You will need a shared variable to control the total number ofI/O operations because it is not known before hand the numbers ofI/O operations initiated by each Devicedriver.
  5. Once Drivers have served all request they haveto signal DOIO.
  6. Once DOIO receives signals fromDrivers indicating all request have been served.DOIO will shut down both Disks.  

Project Direction:

You will write the program C--based on the BACIinterpreter


lol, this is the whole assignment. theres bo more info topost.

Answer & Explanation Solved by verified expert
4.1 Ratings (801 Votes)
The below code might resolve the problem provided above Please go through the code and try to understand the details of every line by which the    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students