Question: COSC 3 5 4 . 0 0 2 Operating Systems Project 3 - CPU Scheduling Points Possible: 1 0 0 There should be no collaboration
COSC Operating Systems
Project CPU Scheduling
Points Possible:
There should be no collaboration among students. A student shouldnt share any project
code with any other student. Collaborations among students in any form will be treated as a
serious violation of the University's academic integrity code.
Objectives:
Complete the source code to simulate CPU scheduling.
Build a binary program on a Linux machine.
Run the program and record the result of the simulation.
Manage the scheduling algorithms Round Robin with priority used in this project.
Requirements:
Each student should independently accomplish this project assignment. You may
discuss with other students to solve the coding problems.
Important! Read the IO format specification carefully and follow. It is very important to
your final grade of this project!
Important! The project must be executed on a Linux operating system. Use the CentOS
virtual machine configured in Project or any other Linux operating system.
Introduction to Round Robin Schedule with a Priority
Round Robin RR with a priority is a CPU scheduling algorithm where each process is
assigned a fixed time slot in a cyclic way.
Assume there are processes with a structure of a Process Control Block PCB:
Process ID: identify each process.
Priority: integer the bigger the number is the higher the priority is The number
will be decreased by once a process has done for a quantum.
Execution time user input: how many ms a process needs.
Status: Readyinitialized Terminated and currently running. Represented by letter R
F and r respectively.
To simplify our simulation, we assume all the processes arrive at the same time Also, we do
not require you to implement a cyclic linked list to connect all processes structure using
pointers. We define the structure of PCB in source code and simply store them in an array, and
looping each PCB every time we use them
Follow the Format Specification Points
In the source file "FirstnameLastname.c you will find first four comment lines:
##BEGIN# DO NOT MODIFY THIS COMMENT LINE!
Firstname
Lastname
##END# DO NOT MODIFY THIS COMMENT LINE!
Your first task is modifying the two lines between the beginning line and end line. Change them
into your first name and last name. Remember the strings are casesensitive so capitalize the
first letter of the word and follow exactly the syntax of the example.
You can see lots of similar code blocks in the file. You are free and supposed to fill your answer
between those special beginning and ending comment lines. You can insert and edit multiple
lines between special comment lines in anyways, howeverImportant as the comment
indicated, do not modify the special begin and comment lines themselves!
Let's do the second task. Scroll down to the bottom of the file and find those lines press "shift
g if you are using vivim:
##BEGIN# DO NOT MODIFY THIS COMMENT LINE!
bannerid ;
##END# DO NOT MODIFY THIS COMMENT LINE!
Look at your student ID card, check your banner ID Again, change the "bannerid value to
your own ID Your unique student id will be compiled into the program, and the input of the
experiment also uniquely depends on your ID
Warning: Since every student has a unique id number, the later compiled binary file is also
unique. Copy binary file from other students will be easily detected!
Complete Source Code Points
Read the source code and rest comments, try to understand the function of each line of code.
Follow the instructions in the comments and insert proper code into the rest blocks to
implement a CPU scheduling with RRPriorityCC files are acceptable Read the
requirements carefully, because some blocks require exact syntax.
Run and Record Simulation Result Points
Compile your source code into a binary program. For example, use following command
$ gcc FirstnameLastname.c o FirstnameLastname
You can run the program and setup any condition you wish to simulate.
$ FirstnameLastname
Play the program for a while and observe how it works. Now we run a specific simulation:
take the last five digits reversed and set them as the priority set their running time
respectively. Gives any five id your like to the processes
For example, there is a banner id then the last reversed digits and
I call process AABBCCDDEE then my entire setup for process will be:
process id priority running time
AA
BB
CC
DD
EE
We have already learned instructions of how to use command script recording commands in the
terminal in project here we use the script command to record.
$ script FirstnameLastname.script
Script started, file is typescript
$ FirstnameLastname
bannerid:
ID PRIORITY RUNTIMEPCB
The program starts running and waits for your inputs. In this example, according to my setup of
processes, my first line input as following:
$ AA
Press enter and finish the rest lines of input. Following the instructions are given by the program
and run the program until the end. Then exit recording and save it into typescript file
"FirstnameLastname.script" by the following command
$ exit
exit Script done, file is FirstnameLastname.script
Warning: Since every student has a unique id number, the result of the simulation is also unique.
Copy simulation results from other students will be easily detected!
Deliverables Points
Since you have generated multiple script files, please save all the script files in one
directory. Create a folder "FirstnameLastname" first. Please make sure the folder name in
correct form. You can use the command mv to rename the folder:
$ mv foldername FirstnameLastname
Make sure all the three files are into this folder. You should have those following files inside the
folder:
commands recording file: FirstnameLastname.script
executable binary file: FirstnameLastname
source code file: FirstnameLastname.c
Achieve all the folder into a single tarred and compressed file with a tar command.
tar zcvf FirstnameLastname.tar.gz FirstnameLastname
You need to submit one tarred file with a format: FirstnameLastname.tar.gz
Grading Criteria:
Follow the format specification:
a Do not break the special comments.
b Input your name properly mark #
c Input your banner id properly mark #
Complete the source code:
a mark # ~ #
b See detailed specifications for each blank in the source code file.
Compiling and running result:
a Compile the code successfully.
b Running the program properly depends on your ID
c Record the running results.
Deliverables:
a Contains all the files.
b Naming all the files properly
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
