Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in C that simulates a CPU scheduler. Implement a CPU scheduling simulator. The program must read from a file the following information:

Write a program in C that simulates a CPU scheduler.

Implement a CPU scheduling simulator. The program must read 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.

The scheduling simulator must be implemented in C and use each of the following algorithms: FCFS, SJF, Priority and Round-Robin.

The quantum for Round-Robin is required, and only for that algorithm. The file format provides all of the information for the processes that will need to be scheduled. 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.

Example Output: 4 4 3 7 2 3 10 3 5 7 1 7 1

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

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions

Question

1. Design an effective socialization program for employees.

Answered: 1 week ago