Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this project, you will implement a CPU scheduling simulator. You will be reading from a file the following information: number of processes, process arrival

In this project, you will implement a CPU scheduling simulator. You will be reading from a file the following information: number of processes, process arrival order, CPU burst per process, and priority per process. Command line parameters will select which scheduling algorithm to use and the quantum value (if required).

The following command line arguments can occur in any order on the command line. All other command line options should be considered file inputs. Your program needs to only handle processing the first file encountered, but be aware that other command line parameters (e.g., -s) may occur after the file name.

Required: -s # Scheduling algorithm to use identified by number. The table below describes the association of parameters to scheduling algorithms.

-s 1

First-Come, First-Served (FCFS)

-s 2

Shortest-Job First (SJF)

-s 3

Priority

-s 4

Round-Robin (RR)

Required for RR only: -q # The quantum to use in the Round-Robin scheduling algorithm. This option is not required for the other scheduling algorithms, and, if provided for those algorithms, is ignored.

The file format provides all of the information for the processes that you will need to schedule. The first line of the file contains a single number identifying the number of processes in the file that you will be scheduling (4 in the example below). The number of processes will range from 1 to an undefined upper bound (your program will need to handle a large number of processes). You may assume that the file is formatted correctly.

The subsequent lines in the file each describe one process indicating the process identifier, the CPU burst length, and the priority of the process. For example, the 4 3 7, in the example below, indicates that process 4 has a CPU burst of 3 and priority 7. A lower number means higher priority. You may assume that the process identifiers are integers, but do not assume that the process identifiers are contiguous starting at 1. For example, you may be processing a file with the following set of five processes: 12, 24, 23, 103, 99.

The order of the processes in the file is their arrival order. In the example below, the processes arrive in the following order: 4, 2, 3, 1.

4

4 3 7

2 3 10

3 5 7

1 7 1

After your program parses the command line arguments, your program will display these parameters. This should identify the scheduling algorithm by name and index.

After reading the test file, you will need to display the arrival order and process information. The process information displayed before running the scheduling algorithm will be the process identifier, the CPU burst length, and the priority of the process.

Your program will then run the appropriate scheduling algorithm keeping track of the waiting time, and turnaround time for each process. When the scheduling algorithm starts running your program should display the message: Running...

Once the scheduling algorithm has finished with all of the processes, it will then display the following information (in the order below) for each process (in arrival order) with each line prefixed with the # symbol:

1. Process identifier

2. CPU burst length

3. Priority

4. Waiting time

5. Turnaround time.

Then your program will calculate and display (prefixed with the # symbol) the average waiting time, and average turnaround time. This information will be displayed after displaying information for each process.

Thank you!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions

Question

What statements did you use? In what tone of voice?

Answered: 1 week ago