proj-cpu-scheduler

proj-cpu-scheduler - CSSE 340 Operating Systems Project 2...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSSE 340 Operating Systems Project 2: CPU Scheduling Simulator 1. Project Objectives This programming project is to simulate a few CPU scheduling policies discussed in the class. You will write a C/C++ program to implement a simulator with different scheduling algorithms. The simulator selects a task to run from ready queue based on the scheduling algorithm. Since the project intends to simulate a CPU scheduler, so it does not require any actual process creation or execution. When a task is scheduled, the simulator will simply print out what task is selected to run at a time. It outputs the way similar to Gantt chart style. 2. Project Descriptions The selected scheduling algorithms to implement in this project are 1) First Come First Serve ( FCFS ) 2) Round Robin ( RR ) 3) Shortest Remaining Time First ( SRTF ). Note that it is not SJF. The detailed algorithms are already described in class slides and textbook Chapter 5. 2.1 Task Information The task information will be read from an input file. The format is pid arrival_time burst_time All of fields are integer type where pid is a unique numeric process ID arrival_time is the time when the task arrives in the unit of milliseconds burst_time the is the CPU time requested by a task, in the unit of milliseconds The time unit for arrival_time, burst_time and interval is millisecond. 2.2 Command-line Usage and Examples Usage: proj2 input_file [FCFS|RR|SRTF] [time_quantum] where input_file is the file name with task information described in section 2.1. FCFS, RR, and SRTF are names of scheduling algorithms. The time_quantum only applies to RR. FCFS is non-preemptive while RR and SRTF are all preemptive . The last argument is needed only for RR. (See following table for more examples) Examples Description proj2 input.1 FCFS FCFS scheduling with the data file “ input.1 proj2 input.1 RR 2 Simulate RR scheduling with time quantum 2 milliseconds (4 th parameter is required even for quantum 1 millisecond) with the data file “ input.1 proj2 input.1 SRTF Simulate SRTF scheduling with the data file “ input.1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2.2 Design Hints No sample code will be given for this project . However, here is a possible design logic you can refer to. The simulator first reads task information from input file and stores all data in a data structure. Then it starts simulating one scheduling algorithm in a time-driven manner. At each time unit (or slot), it adds any newly arrived task(s) into the ready queue and calls a specific scheduler algorithm in order to select appropriate task from ready queue. When a task is chosen to run, the simulator prints out a message indicating what process ID is chosen to execute for this time slot. If no task is running (i.e. empty ready queue), it prints out an “idle” message. Before advancing to the next time unit, the simulator should update all necessary changes in task and ready queue status. 2.3 Sample Inputs and Outputs
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/01/2011 for the course CSSE 250 taught by Professor Dr.yingwuzhu during the Spring '11 term at UH Clear Lake.

Page1 / 6

proj-cpu-scheduler - CSSE 340 Operating Systems Project 2...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online