CMPSCHomework III Solution

PROBLEM DESCRIPTION No real program uses the CPU for the entirety of its execution. It must occasionally interact with an external device, for input or output, if it is ever to do anything meaningful. Most external devices appear to be 'slow' from the point of view of the CPU. A good operating system, then, would not simply have the CPU sit idle while a process is accessing the disk or the network or waiting for keyboard input. It will attempt to pass the CPU to some other process that is ready to run, resuming the first process at some later point when it is ready. IMPLEMENTATION DETAILS The new behavior is represented in the provided files. NOTE CAREFULLY: These files have the same name and serve the same purpose as some files for Homework 2. Take care that you do not overwrite and lose your previous work when you download them! process.cpp extends the constructor so that a process is now represented as a series of CPU bursts separated by disk activity. When the run function completes, it now has another possible response, indicating that a current CPU burst is complete, and that the process wishes to access the disk. scheduler.cpp has a function to respond to that request. If the runScheduler function sees the 'D' returned from Process::run it can use the diskRequest function to resolve that request. This function has been encapsulated so that later assignments can do a similar thing for other peripheral devices. Representing the disk behavior will be vary simple -- with just one integer value representing the time index for when it will next be available for use. It will handle all requests in the order they arrive, but will not need any queue data structure to do so. EXTRA CREDIT OPTION: No programming requirement is here for this part, to allow more time to work on Homework 4, which will have a lot of busy work, and spans the time covering the first midterm. But for those who want to think more about what this project means, beyond being an exercise in programming with linked lists: Consider the results of your simulations in Homeworks #2 and #3. What effect does the choice of First Come First Served and Round Robin have on the outcome? Can you identify any circumstances that would make the Round Robin preferable in either case? Place your answer in the Message Box when submitting your program.
Powered by