CSSE 340 Operating Systems Project 2: CPU Scheduling Simulator

Similar documents
Programming Assignment HW5: CPU Scheduling draft v04/02/18 4 PM Deadline April 7th, 2018, 5 PM. Late deadline with penalty April 9th, 2018, 5 PM

Programming Assignment HW4: CPU Scheduling v03/17/19 6 PM Deadline March 28th, 2019, 8 PM. Late deadline with penalty March 29th, 2019, 8 PM

CPU Scheduling Algorithms

EECE.4810/EECE.5730: Operating Systems Spring 2018 Programming Project 3 Due 11:59 PM, Wednesday, 4/18/18 Monday, 4/30/18

Review. Preview. Three Level Scheduler. Scheduler. Process behavior. Effective CPU Scheduler is essential. Process Scheduling

Preview. Process Scheduler. Process Scheduling Algorithms for Batch System. Process Scheduling Algorithms for Interactive System

Properties of Processes

Operating System Concepts Ch. 5: Scheduling

Homework Assignment #5

CS370 Operating Systems

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

So far. Next: scheduling next process from Wait to Run. 1/31/08 CSE 30341: Operating Systems Principles

Chapter 6: CPU Scheduling

CHAPTER 2: PROCESS MANAGEMENT

Ch 4 : CPU scheduling

CPU Scheduling: Part I ( 5, SGG) Operating Systems. Autumn CS4023

Assignment 3 (Due date: Thursday, 10/15/2009, in class) Part One: Provide brief answers to the following Chapter Exercises questions:

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013

Lab 3 Process Scheduling Due date: 29-Nov-2018

King Saud University. College of Computer & Information Sciences. Information Technology Department. IT425: Operating Systems.

CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Project 1 (document version 1.3) Process Simulation Framework

CPU scheduling. Alternating sequence of CPU and I/O bursts. P a g e 31

Operating Systems Comprehensive Exam. Fall Student ID # 10/31/2013

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

CS630 Operating System Design, First Exam, Spring 2017,

EECE.4810/EECE.5730: Operating Systems Spring 2017 Homework 3 Solution

Sample Questions. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

Chapter 6: CPU Scheduling

Last class: Today: CPU Scheduling. CPU Scheduling Algorithms and Systems

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

3. CPU Scheduling. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn

COSC243 Part 2: Operating Systems

CPU Scheduling. Schedulers. CPSC 313: Intro to Computer Systems. Intro to Scheduling. Schedulers in the OS

Operating Systems Comprehensive Exam. Spring Student ID # 2/17/2011

COMP SCI 3SH3: Operating System Concepts (Term 2 Winter 2006) Test 2 February 27, 2006; Time: 50 Minutes ;. Questions Instructor: Dr.

Project 2: CPU Scheduling Simulator

OPERATING SYSTEMS. UNIT II Sections A, B & D. An operating system executes a variety of programs:

ALL the assignments (A1, A2, A3) and Projects (P0, P1, P2) we have done so far.

CS370 Operating Systems

TDDD82 Secure Mobile Systems Lecture 6: Quality of Service

Department of Computer applications. [Part I: Medium Answer Type Questions]

CPU Scheduling. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

CS 3204 Operating Systems Programming Project #2 Job / CPU Scheduling Dr. Sallie Henry Spring 2001 Due on February 27, 2001.

Chapter 5 CPU scheduling

CS370 Operating Systems

CPU Scheduling (1) CPU Scheduling (Topic 3) CPU Scheduling (2) CPU Scheduling (3) Resources fall into two classes:

Project for CS503: Operating System. Simulation of CPU Scheduling

CPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013)

CSC 716 Advanced Operating System Fall 2007 Exam 1. Answer all the questions. The maximum credit for each question is as shown.

CSE 4/521 Introduction to Operating Systems

Lecture 2 Process Management

1. CPU utilization: it is the percentage of time the CPU is used for a specific time period ones want to keep the CPU as busy as possible (Max.

Scheduling. Scheduling 1/51

Unit 3 : Process Management

Round Robin (RR) ACSC 271 Operating Systems. RR Example. RR Scheduling. Lecture 9: Scheduling Algorithms

Class average is Undergraduates are performing better. Working with low-level microcontroller timers

CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Project 2 (document version 1.4) CPU Scheduling Algorithms

CPU Scheduling. Rab Nawaz Jadoon. Assistant Professor DCS. Pakistan. COMSATS, Lahore. Department of Computer Science

OS Assignment II. The process of executing multiple threads simultaneously is known as multithreading.

Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts. Scheduling Criteria Scheduling Algorithms

Job Scheduling. CS170 Fall 2018

Chapter 5: CPU Scheduling

Operating Systems (1DT020 & 1TT802)

CPSC 457 OPERATING SYSTEMS MIDTERM EXAM SOLUTION

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Course Syllabus. Operating Systems

CS418 Operating Systems

Practice Exercises 305

Scheduling. Scheduling 1/51

FCM 710: Architecture of Secure Operating Systems

CPU Scheduling. Basic Concepts. Histogram of CPU-burst Times. Dispatcher. CPU Scheduler. Alternating Sequence of CPU and I/O Bursts

Chapter 5: CPU Scheduling

Scheduling. Multi-processing. Process Characterization. time. ...makes use of idle. COS450-F18-05-Scheduling - October 8, 2018

Midterm I October 12 th, 2005 CS162: Operating Systems and Systems Programming

CPU Scheduling: Objectives

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

SAMPLE MIDTERM QUESTIONS

Process Scheduling Part 2

8th Slide Set Operating Systems

Chapter 5: CPU Scheduling. Operating System Concepts 8 th Edition,

CISC 7310X. C05: CPU Scheduling. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 3/1/2018 CUNY Brooklyn College

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Example Sheet for Operating Systems I (Part IA)

Performance Analysis of Modified Round Robin CPU Scheduling Algorithm

1.1 CPU I/O Burst Cycle

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

CS450 OPERATING SYSTEMS FINAL EXAM ANSWER KEY

CS370 Operating Systems

CS3733: Operating Systems

Last Class: Processes

Example Sheet for Operating Systems I (Part IA)

STUDENT NAME: STUDENT ID: Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Total

TDIU25: Operating Systems II. Processes, Threads and Scheduling

Operating Systems Unit 3

Operating Systems: Quiz2 December 15, Class: No. Name:

A COMPARATIVE STUDY OF CPU SCHEDULING POLICIES IN OPERATING SYSTEMS

Scheduling of processes

B. V. Patel Institute of Business Management, Computer &Information Technology, UTU

Transcription:

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), and 3) Shortest Remaining Time First (SRTF). 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 nonpreemptive while RR and SRTF are all preemptive. The last argument is needed only for RR. (See following table for more examples) Examples proj2 input.1 FCFS proj2 input.1 RR 2 proj2 input.1 SRTF Description FCFS scheduling with the data file input.1 Simulate RR scheduling with time quantum 2 milliseconds (4th parameter is required even for quantum 1 millisecond) with the data file input.1 Simulate SRTF scheduling with the data file input.1 2.2 Design Hints No sample code will be given for this project. However, here is a possible design logic you can refer. 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 Sample input files and expected outputs are shown in Appendix. You can use it to verify your results. Notice that these input files are not for testing and grading your program in. 3. Requirements: The project requires to simulate FCFS, RR, and SRTF scheduling for given tasks and to compute the average waiting time, response time, turnaround time and overall CPU usage. You can find their definitions in textbook as well as in class slides. [1] Implement scheduling algorithm for FCFS, RR, and SRTF. The program should schedule tasks and print progress of task every unit time (millisecond) as shown in sample outputs. [2] Print statistical information. As soon as all tasks are completed, the program should compute and print 1) average waiting time, 2) average response time, 3) average turnaround time and 4) overall CPU usage. Note: if you use static array to implement ready queue structure, you can assume the maximum queue length is 20. 4. Suggested Methodology: [1] Implement one scheduling algorithm at each step [2] You can use circular linked list as a queue structure [3] You can use a data structure similar to PCB for each task, though it will be much simpler 5. Submission: [1] All source code files [2] A readme file that briefly describe each file, how to compile the file(s), and how to run the file. [3] Due date: 10/17, Tuesday, 1:30PM [4] Makefile file is optional (but it is preferred). [5] Email your files to zhuy@seattleu.edu with subject CSSE340 Project2, but no zip files which will not be accepted by the SU email server. 6. Grading Policy: [1] If you do not have the files specified above, it will result in a score of zero. [2] If the program cannot be compiled and run, it will result in a score of zero. [3] Collaboration will result in a score of zero for all the students involved.

7. Appendix: about input file and output information by CPU scheduling simulator for FCFS, RR, and SRTF % more input.1 1 0 10 2 0 9 3 3 5 4 7 4 5 10 6 6 10 7 % proj2 Usage: proj2 input_file FCFS RR SRJF [quantum] % proj2 input.1 FCFS Schdeuling algorithm: FCFS ====== <system time 0> process 1 is running <system time 1> process 1 is running <system time 2> process 1 is running <system time 3> process 1 is running <system time 4> process 1 is running <system time 5> process 1 is running <system time 6> process 1 is running <system time 7> process 1 is running <system time 8> process 1 is running <system time 9> process 1 is running <system time 10> process 1 is finished... <system time 10> process 2 is running <system time 11> process 2 is running <system time 12> process 2 is running <system time 13> process 2 is running <system time 14> process 2 is running <system time 15> process 2 is running <system time 16> process 2 is running <system time 17> process 2 is running <system time 18> process 2 is running <system time 19> process 2 is finished... <system time 19> process 3 is running <system time 20> process 3 is running <system time 21> process 3 is running <system time 22> process 3 is running <system time 23> process 3 is running <system time 24> process 3 is finished... <system time 24> process 4 is running <system time 25> process 4 is running <system time 26> process 4 is running <system time 27> process 4 is running <system time 28> process 4 is finished... <system time 28> process 5 is running <system time 29> process 5 is running <system time 30> process 5 is running <system time 31> process 5 is running <system time 32> process 5 is running <system time 33> process 5 is running <system time 34> process 5 is finished... <system time 34> process 6 is running <system time 35> process 6 is running <system time 36> process 6 is running <system time 37> process 6 is running <system time 38> process 6 is running <system time 39> process 6 is running <system time 40> process 6 is running <system time 41> process 6 is finished...

Avarage cpu usage : 100.00 % Avarage waiting time : 14.17 Avarage response time : 14.17 Avarage turnaround time: 21.00 % proj2 input.1 RR 2 Schdeuling algorithm: RR ====== <system time 0> process 1 is running <system time 1> process 1 is running <system time 2> process 2 is running <system time 3> process 2 is running <system time 4> process 1 is running <system time 5> process 1 is running <system time 6> process 3 is running <system time 7> process 3 is running <system time 8> process 2 is running <system time 9> process 2 is running <system time 10> process 1 is running <system time 11> process 1 is running <system time 12> process 4 is running <system time 13> process 4 is running <system time 14> process 3 is running <system time 15> process 3 is running <system time 16> process 5 is running <system time 17> process 5 is running <system time 18> process 6 is running <system time 19> process 6 is running <system time 20> process 2 is running <system time 21> process 2 is running <system time 22> process 1 is running <system time 23> process 1 is running <system time 24> process 4 is running <system time 25> process 4 is running <system time 26> process 4 is finished... <system time 26> process 3 is running <system time 27> process 3 is finished... <system time 27> process 5 is running <system time 28> process 5 is running <system time 29> process 6 is running <system time 30> process 6 is running <system time 31> process 2 is running <system time 32> process 2 is running <system time 33> process 1 is running <system time 34> process 1 is running <system time 35> process 1 is finished... <system time 35> process 5 is running <system time 36> process 5 is running <system time 37> process 5 is finished... <system time 37> process 6 is running <system time 38> process 6 is running <system time 39> process 2 is running <system time 40> process 2 is finished... <system time 40> process 6 is running <system time 41> process 6 is finished... Avarage cpu usage : 100.00 % Avarage waiting time : 22.50 Avarage response time : 4.00 Avarage turnaround time: 29.33 % proj2 input.1 SRTF Schdeuling algorithm: SRTF ======

<system time 0> process 2 is running <system time 1> process 2 is running <system time 2> process 2 is running <system time 3> process 3 is running <system time 4> process 3 is running <system time 5> process 3 is running <system time 6> process 3 is running <system time 7> process 3 is running <system time 8> process 3 is finished... <system time 8> process 4 is running <system time 9> process 4 is running <system time 10> process 4 is running <system time 11> process 4 is running <system time 12> process 4 is finished... <system time 12> process 2 is running <system time 13> process 2 is running <system time 14> process 2 is running <system time 15> process 2 is running <system time 16> process 2 is running <system time 17> process 2 is running <system time 18> process 2 is finished... <system time 18> process 5 is running <system time 19> process 5 is running <system time 20> process 5 is running <system time 21> process 5 is running <system time 22> process 5 is running <system time 23> process 5 is running <system time 24> process 5 is finished... <system time 24> process 6 is running <system time 25> process 6 is running <system time 26> process 6 is running <system time 27> process 6 is running <system time 28> process 6 is running <system time 29> process 6 is running <system time 30> process 6 is running <system time 31> process 6 is finished... <system time 31> process 1 is running <system time 32> process 1 is running <system time 33> process 1 is running <system time 34> process 1 is running <system time 35> process 1 is running <system time 36> process 1 is running <system time 37> process 1 is running <system time 38> process 1 is running <system time 39> process 1 is running <system time 40> process 1 is running <system time 41> process 1 is finished... Avarage cpu usage : 100.00 % Avarage waiting time : 10.50 Avarage response time : 9.00 Avarage turnaround time: 17.33