The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 313 Weeks Ago, 6 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Having a difficult time with this code. Any help is much appreciated!
1.- In this assignment you will implement a simulation of the interaction of user programs with the OS to execute an I/O operation on two different devices.
University of Central Florida
Department of Computer Science
CGS3763: Operating System Concepts
Summer 2017
Programming project #3 (Concurrency and the I/O subsystem)
(Five Users - DOIO – Two Device driver – Two Disk)
Due July 26th, 2017 (11:59 p.m.)
1.- In this assignment you will implement a simulation of the interaction of user programs with the OS to execute an I/O operation on two different devices.
User programs:
User programs will communicate with DOIO (OS) to request an I/O operation. (This will simulate a system call)
User programs will give to DOIO three parameters: User id, device number (dev is a random number in the range 1 and 2 that represents device one or device two) and an address (addr is a random number in the range 1 and 20.) (addr is an integer that represents a track number in the hard drive).
User programs will pass the parameters to DOIO through three buffers of size one each (bufid, bufdev, and bufaddr).
Once the parameters are stored in the buffers, user programs executes a p(request_served) operation to wait for the completion of the I/O operation. You will need a semaphore array request_served[5].
There will be five users running concurrently and each will execute 5 I/O operations.
DOIO:
DOIO will collect and id, device(dev), and address(addr) from bufid, bufdev, and bufaddr to assemble the IORB.
DOIO will check on device number to decide which one of the two devices will get the IORB.
Once the device has been selected, DOIO will store the IORB (id and addr) into the two buffers that represent the IORQ (iorqid and iorqaddr) of the selected device. Notice that you need separate buffers (one for each device).
Device drivers (1 and 2):
Device drivers will collect an IORB (made up of id and addr) from iorqid and iorqaddr and then initiate the physical I/O operation on the hard drive it controls and wait for the I/O operation to be completed: p(operation_complete).
The device driver initiates the physical I/O operation by storing addr into a buffer of length one. The buffer name is “pio” (physical I/O).
When the I/O operation completes a signal is received, the Device driver will identify the User that issued the I/O request using the id, and will signal the semaphore “request_served” associated to the User.
Disk (1 and 2):
The Disk processes simulates the access to a track in the hard drive.
The Disk process gets the addr from 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”
a) Define all semaphores that you need according to the number of buffers used.
b) Each user will make 5 system calls to initiate I/O operations
c) DOIO will create 25 IORB
d) The sum of the I/O operations executed by drivers must add up 25. You will need a shared variable to control the total number of I/O operations because it is not known before hand the numbers of I/O operations initiated by each Device driver.
Project Direction
You will write the program C-- based on the BACI interpreter that you used in programming project 1.
Test your solution
You must run and test your solution for correctness, as well as, comment on the code and the expected results. If this were a task for an employer, you would be expected to follow company policy, including naming, conventions, and syntax.
Project Submission
What to submit?
Submit the source code(.cm file) with comments and the output file (.txt) showing the results.
Example for the print out of results:
User 1 executes system call SIO or DOIO
DOIO assembles IORB and inserts it in IORQ for user 1
User 2 executes system call SIO or DOIO
Driver initiates I/O operation for user 1
User 3 executes system call SIO or DOIO
User 4 executes system call SIO or DOIO
DOIO assembles IORB and inserts it in IORQ for user 2
Disk Completes I/O operation (disk does not know what process initiated the I/O operation)
Driver signal user 1 (operation complete)
User 1 executes system call SIO or DOIO
DOIO assembles IORB and inserts it in IORQ
And so on…
Projects will be submitted through WebCourses.
Resources:
http://inside.mines.edu/~tcamp/baci/baci_index.html
http://inside.mines.edu/~tcamp/baci/cmimi.pdf
In folder JBACI on Webcourses you will find a guide to download and install jBACI.
See Rubric on next page...
Grading Rubric - 100 Points Total
Important!
· Must compile in jBaci (automatic -80 points if code does not compile). This includes .c and java files.
Code (50 points)
· Must include student, class, and assignment info in opening comments.
· Use of proper indentation.
· Use of comments.
· No deadlocks.
· Proper declaration of semaphores (binarysems).
· Proper use of local and global variables.
· Proper use of semaphores.
· Proper use of buffers.
Output (25 points)
· Automatic -25 points if output not included in submission.
· Output is in proper or expected order.
· Variables are outputted at run time, not hard-coded. (ie “User ” << id, not “User 1”)
· Lines are uniform and symmetric. Use of “\t” highly recommended.
· No other data in output. (NetBeans information or “Program Completed”)
Submission (25 points)
· Code in .cm format and Output in .txt format.
· Either two files or one compressed file.
· No spaces in any file names or in compression of files. Use underscores for spaces.
Late Submissions
· -20 points if submitted at 12:am or later than submission due date and time.
· Tardy submissions are not allowed
Attachments:
----------- ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly