Purpose

This lab is designed to cover different types of scheduling used in operating systems, such as Round Robin. Please make sure that all of your answers to questions in these labs come from work done on the Edlab environment - otherwise, they may be inconsistent results and will not receive points.

The TA present in your lab will do a brief explanation of the various parts of this lab, but your group is expected to answer all questions on your own. Please raise your hand if you have any questions during the lab section. Questions and Parts have a number of points marked next to them to signify their weight in this lab’s final grade.

Please read through this lab and follow the instructions. After you do that, visit Gradescope and complete the questions associated with this lab by the assigned due date.

You may work in groups up to 4 to complete this lab. Make sure you submit as a group in Gradescope.

Setup

Once you have logged in to Edlab, clone this repository. You can do this by clicking on the "Code" drop down, clone using HTTPS, and copy the repositories URL:

https://user-images.githubusercontent.com/348202/192867111-70299f73-979c-4b15-84f5-9f036932a02f.png

You then clone the repository with the URL REPO_URL like so:

git clone <https://github.com/umass-cs-377/377-lab-scheduling-F22.git>

Then you can use cd to open the directory you just cloned:

cd REPO

This repo includes a Makefile that allows you to compile and run all the sample code listed in this tutorial. You can compile them by running make. Feel free to modify the source files yourself, after making changes you can run make again to build new binaries from your modified files. You can also use make clean to remove all the built files, this command is usually used when something went wrong during the compilation so that you can start fresh.

Part 1: FIFO (10 Points):

One scheduling algorithm is FIFO, or First In First Out. As it sounds, the scheduling algorithm simply runs whichever processes arrive first, and finishes with whichever processes arrive last. In essence, it acts like a line at the grocery store, taking whichever customer arrives first. While this does grant every process hypothetical fastest time, in reality a very slow process could bog down the system like a grocer with too much produce. If that happens, faster processes like a customer with only 10 items or less could be forced to wait even though they could be done in a short period of time.

Part 2: SJF (10 Points):

The grocer with 10 items or less complained to the manager about their FIFO policy, and the store has now changed to the SJF policy, or Shortest Job First. With this new policy, the scheduling algorithm runs whichever process is the shortest, and finishes with whichever process is the longest. In the supermarket, this means that if someone has a lot of produce and is taking a while to check out, the cashier will tell them to wait and checks out someone with only a few items first. This leads to its own problem, however, in that the new policy only checks for shoppers that are all in line at the same time – if someone with a lot of groceries arrives before everyone else, they still have to wait for the one shopper to finish.

Part 3: RR (10 Points):

Finally, the manager has had enough. Customers keep complaining, and they have no idea how to stop it. For their final act, they implement the RR policy, which dictates that customers be partial checked out one after another, looping through the line over and over again until everyone is checked out. This policy means that shoppers will all receive attention one at a time, but may take a while to finish if there are many customers in line.

However, Round Robin requires that processes be attended to for a while before moving onto the next one – otherwise, the cost of switching between processes becomes large enough that it fails to save any time at all. Additionally, while processes all get attention from the CPU relatively soon, it is terrible in turnaround time, since it must slowly iterate through all of the processes until it finishes.