CS 537: Intro to Operating Systems (Fall 2017) Worksheet 3 - Scheduling & Process API Due: Sep 27 th 2017 (Wed) in-class OR Simmi before 5:30 pm

Similar documents
Properties of Processes

OS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions).

CPU Scheduling Algorithms

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

Chapter 5: CPU Scheduling

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

Last Class: Processes

Chap 7, 8: Scheduling. Dongkun Shin, SKKU

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

Operating Systems. CPU Scheduling ENCE 360

Operating Systems. Process scheduling. Thomas Ropars.

EECE.4810/EECE.5730: Operating Systems Spring Midterm Exam March 8, Name: Section: EECE.4810 (undergraduate) EECE.

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

Multi-Level Feedback Queues

1.1 CPU I/O Burst Cycle

CS 322 Operating Systems Practice Midterm Questions

Supplementary Materials on Multilevel Feedback Queue

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

CSE 4/521 Introduction to Operating Systems

Lecture Topics. Announcements. Today: Uniprocessor Scheduling (Stallings, chapter ) Next: Advanced Scheduling (Stallings, chapter

Chapter 5: CPU Scheduling

CS370 Operating Systems

CS 326: Operating Systems. CPU Scheduling. Lecture 6

Operating System Concepts Ch. 5: Scheduling

Chapter 6: CPU Scheduling

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

CHAPTER 2: PROCESS MANAGEMENT

Process Scheduling. Copyright : University of Illinois CS 241 Staff

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

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

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

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

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

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

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

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

EECE.4810/EECE.5730: Operating Systems Spring 2017

Chapter 5 Scheduling

CSC369 Lecture 5. Larry Zhang, October 19,2015

CS307: Operating Systems

Scheduling of processes

Chapter 5: CPU Scheduling

Chapter 6: CPU Scheduling

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

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

CS-537: Midterm Exam (Fall 2013) Professor McFlub

CS370 Operating Systems

Job Scheduling. CS170 Fall 2018

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

Operating Systems ECE344. Ding Yuan

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

CS370 Operating Systems

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

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

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

COSC243 Part 2: Operating Systems

INF1060: Introduction to Operating Systems and Data Communication. Pål Halvorsen. Wednesday, September 29, 2010

CSE 120 Principles of Operating Systems

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections )

Operating Systems. Scheduling

CS 537: Introduction to Operating Systems Fall 2016: Midterm Exam #1. All cell phones must be turned off and put away.

CS Computer Systems. Lecture 6: Process Scheduling

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

CS630 Operating System Design, First Exam, Spring 2017,

Operating Systems CS 323 Ms. Ines Abbes

CS 370 Operating Systems

Chapter 5 CPU scheduling

Operating Systems. Pablo Prieto Torralbo. 2. Virtualizing CPU DEPARTMENT OF COMPUTER ENGINEERING

CS 537: Introduction to Operating Systems Fall 2015: Midterm Exam #1

Course Syllabus. Operating Systems

Process- Concept &Process Scheduling OPERATING SYSTEMS

High level scheduling: Medium level scheduling: Low level scheduling. Scheduling 0 : Levels

CMPSCI 377: Operating Systems Exam 1: Processes, Threads, CPU Scheduling and Synchronization. October 9, 2002

Processes. Overview. Processes. Process Creation. Process Creation fork() Processes. CPU scheduling. Pål Halvorsen 21/9-2005

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

CS 318 Principles of Operating Systems

Chapter 5: Process Scheduling

Lecture 2 Process Management

Ch 4 : CPU scheduling

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

CPU Scheduling: Objectives

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

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads

CMPS 111 Spring 2003 Midterm Exam May 8, Name: ID:

CS Mid term Exam Maximum points 100; Maximum time allowed: 75 minutes

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

Processes and Threads

Practice Exercises 305

CS3733: Operating Systems

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

Lecture 17: Threads and Scheduling. Thursday, 05 Nov 2009

Operating Systems and Networks Assignment 9

8: Scheduling. Scheduling. Mark Handley

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

CSE 120. Fall Lecture 8: Scheduling and Deadlock. Keith Marzullo

Section 7: Scheduling and Fairness

Chap 7, 8: Scheduling. Dongkun Shin, SKKU

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Scheduling

Project for CS503: Operating System. Simulation of CPU Scheduling

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

Transcription:

CS 537: Intro to Operating Systems (Fall 2017) Worksheet 3 - Scheduling & Process API Due: Sep 27 th 2017 (Wed) in-class OR email Simmi before 5:30 pm 1. Basic Scheduling Assume a workload with the following characteristics. Process Arrival Time (in sec) Service Time (in sec) A 0 8 B 2 4 C 5 7 For SJF, STCF, if there is a tie, schedule the process that arrived the earliest. For RR, assume a time-slice of 1 sec. When a new process enters a particular queue, it is placed at the end of the round robin queue. (a) Can you write the schedule (e.g., AABBCABC) in which these three processes may be scheduled for the following scheduling policies? i. FIFO: ii. SJF: iii. STCF: iv. RR: (b) Fill in the average turnaround time (in sec) and average response time (in sec) of the three processes for the different schedulers given below. Average Turnaround Time Average Response Time FIFO SJF STCF RR

(c) Assume an STCF scheduler for the original workload with processes A, B, and C. Assume a new process D requiring 5 seconds of CPU time arrives at some time T. What is/are the value(s) of T (assuming integer) such that process D preempts the process running at that time? Preemption means descheduling a process that is currently running (and not yet complete) and scheduling a different process. (d) Assume an STCF scheduler for the original workload with processes A, B, and C. Assume a new process E arrives at time 8 seconds. What could be the maximum CPU burst time or service time (assuming integer) for process E such that it preempts the process that was running at time 8? (e) With the round robin (RR) scheduling policy, a question arises when a new job arrives in the system: should we put the job at the front of the RR queue, or the back? Does this decision make a difference, or does RR behave pretty much the same way either way? (Explain) (f) Why is STCF considered one of the best scheduling policies? What does it do? If it is so great, why do we rarely see it implemented in real world schedulers? 2

2. Multi-Level Feedback Queue Assuming processes A, B, and C are CPU-bound (no I/O). There is no overhead for context switching. When a new process enters a particular queue, it is placed at the end of the round robin queue. Consider a Multi-Level Feedback Queue (MLFQ) Scheduler with 3 queues as shown below. After a time interval of 10 seconds, all processes are boosted up to the top-most queue with the highest priority. queue # priority Round Robin time slice 2 2 (highest) 1 1 1 2 0 0 (lowest) 3 The table below gives the details of the workload. Process Arrival Time Service Time A 0 10 B 3 3 C 5 4 (a) Fill the table below with the details of which process will be scheduled for each time unit and at which priority level. In this table, for each time unit n, write which process will be scheduled from time n to n + 1. Priority 2 Priority 1 Priority 0 Time Unit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 (b) Fill the table below with the turnaround time and response time of each process. Process Turnaround Time Response Time A B C 3

3. Process API You may assume that the following two code snippets compile successfully and APIs like fork(), exec(), and wait() never fails. Try NOT to run the code without thinking about it. You may run them to verify your answers, though. Remember, you won t have your best friend, the C compiler, with you during your exam! :) Program 1 Program 2 int counter = 0; int main() { int i; if (fork() == 0) { printf("hello\n"); counter++; printf("%d\n", counter); int counter = 0; int main() { int i; if (fork() == 0) { char *myargs[3]; myargs[0] = "echo"; myargs[1] = "Hello"; myargs[2] = NULL; execvp(myargs[0], myargs); counter++; wait(null); printf("%d\n", counter); (a) After program 1 is executed, how many processes are created? (b) After program 2 is executed, how many processes are created? 4

(c) Draw a process tree diagram, with the counter value printed out by the process in the parenthesis beside that process, after program 1 is executed. If a process does NOT print the counter value, write NULL. For example, the following diagram represents that process A creates process B and process C, and that process C creates process D; the counter value printed out by process A is 0, B is 1, D is 3 and C does NOT print the counter value. In your process tree diagram, there is no specific requirement for labeling a process as long as different processes are labeled with distinct characters. A(0) / \ B(1) C(NULL) \ D(3) (d) Can you draw a similar process tree diagram for program 2? 5