Operating Systems and Networks Assignment 9

Size: px
Start display at page:

Download "Operating Systems and Networks Assignment 9"

Transcription

1 Spring Term 01 Operating Systems and Networks Assignment 9 Assigned on: rd May 01 Due by: 10th May 01 1 General Operating Systems Questions a) What is the purpose of having a kernel? Answer: A kernel is a piece of software which provides save multiplexing/access of the underlying hardware. (a) What is the least functionality a kernel has to provide usually (Hint: Usually a minimal kernel provides three properties)? Answer: A kernel provides at least basic scheduling, some form of message passing (or the setup of channels) and protection (only the kernel sets up page table entries) (b) What does this functionality provide to the rest of the system? Answer: This functionality provides a secure environment to the user-space. The underlying hardware is multiplexed. Every process can get memory, but cannot overwrite any other process s memory. Basic scheduling makes sure, that every process gets some amount of CPU cycles. Basic messaging makes sure that you can build applications which act as servers. Those servers export functionality/services which can be used by other applications. (c) Where does the rest of the system reside? Answer: The rest of the system lives in user space which means in libraries and applications. Applications may provide services to other applications. (d) How does the rest of the system interact with the kernel? Answer: The user-space part of the system interacts via system calls with the kernel. System calls are the gateway to the kernel. (e) Why does it need to interact with the kernel? Answer: Getting more memory means setting up page table entries which can only be done by the kernel. Setting up a message channel cannot be done in user-space, if userspace processes are completely isolated. In general, user-space libraries or applications have to interact with the kernel, if they need some resources which can only be accessed by the kernel. Answer: Note: The description above is about the minimum functionality which usually is provided by a kernel (microkernel). Linux is a monolithic kernel. It provides a lot more functionality to the user-space.

2 b) The kernel can do and access everything. It exports functionality to user applications by syscalls. Does that mean that every user application can execute code in the kernel by doing a syscall? Answer: In theory yes, but the real answer is no. System calls can be performed by every user-space application. However the kernel has to check arguments passed by the calling user application. It also has to check whether the user launching the application is privileged enough to do some operations. In Linux we have the notion of root. For some operations, the kernel checks whether the calling process has root rights. c) Can you compile glibc without the kernel sources? Answer: You can compile glibc without kernel sources. However you need the kernel headers. The reason is that there is an interface between the kernel and the user-space library glibc. The library has to know the system calls. Scheduling The following table describes tasks to be scheduled. The table contains the entry times of the tasks, their duration/execution times and their deadlines. All time values are given in ms. Task Number Entry Execution Time Deadline Scheduling decisions are performed every 10ms. You can assume that scheduling decisions take about no time. The deadline values are absolute..1 Creating schedules In the following you are asked to create different types of schedules. Please visualize your schedule (like in the lecture) and also answer the questions below. Types of schedules: a) RR (Round Robin) b) EDF (Earliest Deadline first) c) SRTF (Shortest Remaining Time First) Please answer the following questions for each of the schedules: a) How big is the wait time per task? b) How big is the average wait time? c) How big is the turnaround time per task? d) How is the response time computed for this scheduler? If possible, calculate the response time per task. Answer: Definitions of the terms turnaround time, waiting time and response time according to the Silberschatz book:

3 The Turnaround time is the time between the submission or arrival of a job until it completes execution. Waiting time is the time the job spends runnable but not executing. This is the sum of all periods the jobs spends in the runqueue, but it is not actually running. Response time is the time it takes from the point where a job becomes runnable to the point where output appears. In general this applies to interactive tasks. For example, how long does it take from the user pressing a key to the character being displayed on the screen? a) RR (Round Robin) We assume, that a task which enters the system can be immediately scheduled and it is at the beginning of the scheduling ring. This leads to the following schedule: Task (a) How big is the wait time per task? 1: 60ms, : 0ms, : 0ms, : 0ms, : 0ms (b) How big is the average wait time? (60ms + 0ms + 0ms + 0ms + 0ms) / = 6ms (c) How big is the turnaround time per task? 1: 90ms, : 70ms, : 60ms, : 10ms, : 60ms (d) The response time In the worst case the task just lost its timeslice (is being preempted by the scheduler) when the user pressed a key. If the task is very fast, it can produce output immediately when it becomes running again. So with jobs we have to wait for jobs which are running in the meantime. 1: jobs scheduled in RR with a timequanta of ( - 1) * 10ms = 0ms b) EDF (Earliest deadline first) The deadlines are absolute if the tasks are non-periodic. If two tasks have the same deadline, we assume that the first found task is going to run. This leads to the following schedule: Task (a) How big is the wait time per task? 1: 0ms, : 60ms, : 10ms, : 0ms, : 0ms (b) How big is the average wait time? (0ms + 60ms + 10ms + 0ms + 0ms) / = 6ms

4 (c) How big is the turnaround time per task? 1: 60ms, : 80ms, : 0ms, : 10ms, : 60ms (d) The response time This is less obvious than in RR scheduling. Since the task are scheduled by their deadline we can say, that if a schedule is feasible, the response time is at most (deadline - entry time - execution time). This leads to: 1: 0ms, : 70ms, : 10ms, : 0ms, : 0ms c) SRTF (Shortest remaining time first) The job with the shortest execution time is always chosen to be executed. This scheduling might lead to starvation as long jobs might never be scheduled due to short running ones. SRTF can lead to the following schedule: Task (a) How big is the wait time per task? 1: 0ms, : 0ms, : 0ms, : 10ms, : 0ms (b) How big is the average wait time? (0ms + 0ms + 0ms + 10ms + 0ms) / = 18ms (c) How big is the turnaround time per task? 1: 80ms, : 0ms, : 0ms, : 0ms, : 60ms (d) The response time There is no formalism that can be developed for SRTF for computing the response time. As SRTF can lead to starvation, it might happen that some jobs are never scheduled. As such, the response time can not be estimated.. General Questions a) What is the problem with shortest job first (SJF) scheduling policy? Answer: Long jobs are potentially never scheduled, if short jobs are entering the system continuously and if there is no preemption. b) What is the advantage of SJF? Answer: It minimizes the waiting time and the turnaround time. c) What is the benefit of round robin? Answer: It is easy to implement, understand and analyze. It has a good response time. d) What is the big conceptual difference between EDF and RR? Answer: EDF is a realtime-based scheduling strategy. Therefore tasks have priorities. RR treats all tasks the same. This is not a realtime scheduling strategy and there is no notion of priorities. e) Why do hard realtime systems often not have dynamic scheduling? Answer: In a dynamic setup it is not possible to guarantee the feasibility of a correct schedule. That means, if new tasks enter the system and the system allows that, it cannot

5 be guaranteed that every task still meets the deadline. The other approach is to first compute whether there is enough time to allow a new task. If not, creation of a new task will fail. This guarantees that the already running task will always meet the deadlines, however it is possible that an important task cannot be created.. Realtime Scheduling You are designing an HD-TV. To keep the production costs low, it has only one CPU which must perform the following tasks: Decode video chunks (takes 0 ms, has to be done every 00ms) Update Screen (takes 0 ms, has to be done every 00 ms) Handle user input (takes 10 ms, has to be done every 0 ms) a) Show that it is possible to schedule all tasks in such a way that all deadlines are met, using Rate Monotonic Scheduling. Do not present a working schedule. Answer: It can be shown that N periodic tasks with the computation times C i and periods P i can be scheduled by ordering the tasks according to their periods if U = N i=1 C i P i N( 1 N 1) For the given values we get: (cf. last question). b) Show that, when the number of tasks approaches infinity, all tasks can be scheduled without violating deadlines if the utilization is below 69.%. Explain how one can arrive at this result. Answer: lim N (N( 1 N 1)) = ln() 0.69 c) Now assume your boss wants you to add DRM to your TV. This requires an extra task with a period of 00 ms and a execution time of 100 ms. (a) What is the utilization of the system now? (b) What is the upper bound according to the theorem used in b)? (c) If you try to build a working schedule by hand, you will see that it is still possible to create one. How can this be explained? Answer: Task i Execution Time C i Period T i C i /T i Utilization Upper Bound The upper bound given above states that if utilization U, for a set of tasks, is below N( 1 N 1) then it is always possible to schedule those tasks - however, it is not a tight upper bound, i.e., there are many cases where feasible schedules can be found even though the utilization reaches 1. Priority Inversion Please explain in detail:

6 a) What is priority inversion? Answer: A lower-priority task is running while a high-priority task is not, but would be runnable. Those two tasks are independent and still the lower-priority task runs instead the high-priority task. b) What is the problem with priority inversion? Answer: High-priority tasks cannot proceed, because lower-priority tasks are running. Blocking high-priority tasks is very bad in general. c) What causes priority inversion? Answer: A low-priority task is holding a lock. Later, a high-priority task is trying to acquire the same lock which it can t, because it is held by the low-priority task. In the meantime, a middle-priority task enters the system and therefore, the low-priority task is preempted, since it has lower priority. The middle-priority task and the high-priority task are completely independent and still the middle-priority task runs instead of the high-priority one. In fact it looks like the middle-priority task has higher priority than the high-priority one. So we have a priority inversion. d) How can this problem be solved? Answer: This can be solved by a priority inheritance scheme. The task holding the lock temporarily inherits the priority of the task which wants to acquire the lock, if this priority is higher. That makes sure, that no middle-priority task can suspend the low-priority task holding the lock. e) Priority inheritance (a) How many levels of priority inheritance do you need? Answer: In general you need as many levels as possible priority levels. If your tasks can have five levels of priorities (for example), then you need to have five levels of priority inheritance. (b) Why? Answer: We know now that the low-priority task holding the lock which a highpriority task wants to acquire has to inherit its priority. However, if for example the low-priority task holds two locks and a high-priority task wants to acquire one of them, it inherits this priority. If a very-high-priority task enters the system and wants to acquire the second lock, the low-priority task inherits the very high priority. After the low-priority task releases the second lock, its priority has to be reset. But we don t want to reset it to the original low priority, since it is still holding the first lock which is also requested by a high-priority task. That means, we should reset the priority from very high to high. In general this can happen with all the possible levels of priorities. A low-priority task might hold many locks. fork() Creating new processes in the Unix/Linux world is done using fork(). fork() clones an existing process and adds it to the runqueue, rather then really creating a new one. Since fork clones a process, they both execute the line after the fork() call. Now they need to distinguish whether they are parent or child process. This can be done by checking the return value of fork(): to the parent process, fork() returns the PID of the child process, to the child process, fork() returns 0.1 Playing with fork().1.1 Calling fork() once Create a program which forks itself once. The parent process should output Im the parent and my child s PID is <pid>. The child should output I m the child and my PID is <pid>. Do the 6

7 PIDs match?.1. fork() multiple times What do you expect to happen here? Please explain what you think will happen. int main(int argc, char **argv) { while(1) { fork(); } } Answer: If you execute this code, your computer will be (almost) dead. Every child forks new children in a loop and this new children fork new children in a loop as well. This consumes too many resources in a very short time. Not only memory, but also CPU cycles, page table entries, descriptors Executing ls -l from your program Write a simple program (main function) which executes the ls program. Look up the manual page for the exec family (man exec). After the exec call in your main function, have a printf which says that you have called exec now. What do you notice? Answer: The line after exec of your program will not be executed. exec replaces the currently executed program by a new one. It does not automatically fork a new process to execute ls -l. How can you fix that? Answer: If you want your program to continue to run, first fork and execute exec in the child. If you want your program to wait until the child process terminated, you can call one of the wait functions (see man wait).. Reading the ls output from a pipe Create a simple application which opens a pipe, executes ls and reads its output via the pipe. Your application should write a sentence and the output of ls to the console (example: Output from ls: <ls output> ). 7

Operating Systems and Networks Assignment 2

Operating Systems and Networks Assignment 2 Spring Term 2014 Operating Systems and Networks Assignment 2 Assigned on: 27th February 2014 Due by: 6th March 2014 1 Scheduling The following table describes tasks to be scheduled. The table contains

More information

Computer Systems Assignment 4: Scheduling and I/O

Computer Systems Assignment 4: Scheduling and I/O Autumn Term 018 Distributed Computing Computer Systems Assignment : Scheduling and I/O Assigned on: October 19, 018 1 Scheduling The following table describes tasks to be scheduled. The table contains

More information

Computer Systems Assignment 2: Fork and Threads Package

Computer Systems Assignment 2: Fork and Threads Package Autumn Term 2018 Distributed Computing Computer Systems Assignment 2: Fork and Threads Package Assigned on: October 5, 2018 Due by: October 12, 2018 1 Understanding fork() and exec() Creating new processes

More information

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

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008. CSC 4103 - Operating Systems Spring 2008 Lecture - XII Midterm Review Tevfik Ko!ar Louisiana State University March 4 th, 2008 1 I/O Structure After I/O starts, control returns to user program only upon

More information

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

OS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions). OS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions). (a) (b) (c) (d) (e) (f) (g) (h) (i) T_ The two primary purposes of an operating

More information

CS 370 Operating Systems

CS 370 Operating Systems NAME S.ID. # CS 370 Operating Systems Mid-term Example Instructions: The exam time is 50 minutes. CLOSED BOOK. 1. [24 pts] Multiple choice. Check one. a. Multiprogramming is: An executable program that

More information

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems Processes CS 475, Spring 2018 Concurrent & Distributed Systems Review: Abstractions 2 Review: Concurrency & Parallelism 4 different things: T1 T2 T3 T4 Concurrency: (1 processor) Time T1 T2 T3 T4 T1 T1

More information

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes Getting to know you Processes A process is an abstraction that supports running programs A sequential stream of execution in its own address space A process is NOT the same as a program! So, two parts

More information

CHAPTER 2: PROCESS MANAGEMENT

CHAPTER 2: PROCESS MANAGEMENT 1 CHAPTER 2: PROCESS MANAGEMENT Slides by: Ms. Shree Jaswal TOPICS TO BE COVERED Process description: Process, Process States, Process Control Block (PCB), Threads, Thread management. Process Scheduling:

More information

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

Processes. Overview. Processes. Process Creation. Process Creation fork() Processes. CPU scheduling. Pål Halvorsen 21/9-2005 INF060: Introduction to Operating Systems and Data Communication Operating Systems: Processes & CPU Pål Halvorsen /9-005 Overview Processes primitives for creation and termination states context switches

More information

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

Preview. Process Scheduler. Process Scheduling Algorithms for Batch System. Process Scheduling Algorithms for Interactive System Preview Process Scheduler Short Term Scheduler Long Term Scheduler Process Scheduling Algorithms for Batch System First Come First Serve Shortest Job First Shortest Remaining Job First Process Scheduling

More information

CSE 4/521 Introduction to Operating Systems

CSE 4/521 Introduction to Operating Systems CSE 4/521 Introduction to Operating Systems Lecture 9 CPU Scheduling II (Scheduling Algorithms, Thread Scheduling, Real-time CPU Scheduling) Summer 2018 Overview Objective: 1. To describe priority scheduling

More information

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

INF1060: Introduction to Operating Systems and Data Communication. Pål Halvorsen. Wednesday, September 29, 2010 INF1060: Introduction to Operating Systems and Data Communication Pål Halvorsen Wednesday, September 29, 2010 Overview Processes primitives for creation and termination states context switches processes

More information

University of Ottawa School of Information Technology and Engineering

University of Ottawa School of Information Technology and Engineering University of Ottawa School of Information Technology and Engineering Course: CSI3131 Operating Systems Professor: Miguel A. Garzón SEMESTER: Winter 2015 Date: Feb 26 2015 Hour: 14:30-16:00 (90 minutes)

More information

(MCQZ-CS604 Operating Systems)

(MCQZ-CS604 Operating Systems) command to resume the execution of a suspended job in the foreground fg (Page 68) bg jobs kill commands in Linux is used to copy file is cp (Page 30) mv mkdir The process id returned to the child process

More information

Processes and Threads

Processes and Threads Processes and Threads Giuseppe Anastasi g.anastasi@iet.unipi.it Pervasive Computing & Networking Lab. () Dept. of Information Engineering, University of Pisa Based on original slides by Silberschatz, Galvin

More information

Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar

Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Mahmoud El-Gayyar / Introduction to OS 1 Processes in Unix, Linux, and Windows Unix pre-empted

More information

COSC243 Part 2: Operating Systems

COSC243 Part 2: Operating Systems COSC243 Part 2: Operating Systems Lecture 17: CPU Scheduling Zhiyi Huang Dept. of Computer Science, University of Otago Zhiyi Huang (Otago) COSC243 Lecture 17 1 / 30 Overview Last lecture: Cooperating

More information

Operating Systems. Process scheduling. Thomas Ropars.

Operating Systems. Process scheduling. Thomas Ropars. 1 Operating Systems Process scheduling Thomas Ropars thomas.ropars@univ-grenoble-alpes.fr 2018 References The content of these lectures is inspired by: The lecture notes of Renaud Lachaize. The lecture

More information

CS4514 Real Time Scheduling

CS4514 Real Time Scheduling CS4514 Real Time Scheduling Jose M. Garrido Fall 2015 Department of Computer Science 1 Periodic Tasks Typical real-time application has many tasks that need to be executed periodically Reading sensor data

More information

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5 OPERATING SYSTEMS CS3502 Spring 2018 Processor Scheduling Chapter 5 Goals of Processor Scheduling Scheduling is the sharing of the CPU among the processes in the ready queue The critical activities are:

More information

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

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm Operating Systems Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) armahmood786@yahoo.com alphasecure@gmail.com alphapeeler.sf.net/pubkeys/pkey.htm http://alphapeeler.sourceforge.net pk.linkedin.com/in/armahmood

More information

Reading Assignment 4. n Chapter 4 Threads, due 2/7. 1/31/13 CSE325 - Processes 1

Reading Assignment 4. n Chapter 4 Threads, due 2/7. 1/31/13 CSE325 - Processes 1 Reading Assignment 4 Chapter 4 Threads, due 2/7 1/31/13 CSE325 - Processes 1 What s Next? 1. Process Concept 2. Process Manager Responsibilities 3. Operations on Processes 4. Process Scheduling 5. Cooperating

More information

Processes. Operating System CS 217. Supports virtual machines. Provides services: User Process. User Process. OS Kernel. Hardware

Processes. Operating System CS 217. Supports virtual machines. Provides services: User Process. User Process. OS Kernel. Hardware es CS 217 Operating System Supports virtual machines Promises each process the illusion of having whole machine to itself Provides services: Protection Scheduling Memory management File systems Synchronization

More information

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

CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Project 1 (document version 1.3) Process Simulation Framework CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Project 1 (document version 1.3) Process Simulation Framework Overview This project is due by 11:59:59 PM on Thursday, October 20, 2016.

More information

Lecture 2 Process Management

Lecture 2 Process Management Lecture 2 Process Management Process Concept An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks The terms job and process may be interchangeable

More information

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017 CS 471 Operating Systems Yue Cheng George Mason University Fall 2017 Outline o Process concept o Process creation o Process states and scheduling o Preemption and context switch o Inter-process communication

More information

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - III Processes. Louisiana State University. Virtual Machines Processes

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - III Processes. Louisiana State University. Virtual Machines Processes CSC 4103 - Operating Systems Spring 2008 Lecture - III Processes Tevfik Ko!ar Louisiana State University January 22 nd, 2008 1 Roadmap Virtual Machines Processes Basic Concepts Context Switching Process

More information

Operating Systems 2014 Assignment 2: Process Scheduling

Operating Systems 2014 Assignment 2: Process Scheduling Operating Systems 2014 Assignment 2: Process Scheduling Deadline: April 6, 2014, at 23:59. 1 Introduction Process scheduling is an important part of the operating system and has influence on the achieved

More information

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

Sample Questions. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic) Sample Questions Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Sample Questions 1393/8/10 1 / 29 Question 1 Suppose a thread

More information

CS 322 Operating Systems Practice Midterm Questions

CS 322 Operating Systems Practice Midterm Questions ! CS 322 Operating Systems 1. Processes go through the following states in their lifetime. time slice ends Consider the following events and answer the questions that follow. Assume there are 5 processes,

More information

Mon Sep 17, 2007 Lecture 3: Process Management

Mon Sep 17, 2007 Lecture 3: Process Management Mon Sep 17, 2007 Lecture 3: Process Management September 19, 2007 1 Review OS mediates between hardware and user software QUIZ: Q: Name three layers of a computer system where the OS is one of these layers.

More information

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

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition Chapter 6: CPU Scheduling Silberschatz, Galvin and Gagne 2013 Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Real-Time

More information

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System Mid Term from Feb-2005 to Nov 2012 CS604- Operating System Latest Solved from Mid term Papers Resource Person Hina 1-The problem with priority scheduling algorithm is. Deadlock Starvation (Page# 84) Aging

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2018 Lecture 8 Threads and Scheduling Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ How many threads

More information

OPERATING SYSTEMS: Lesson 4: Process Scheduling

OPERATING SYSTEMS: Lesson 4: Process Scheduling OPERATING SYSTEMS: Lesson 4: Process Scheduling Jesús Carretero Pérez David Expósito Singh José Daniel García Sánchez Francisco Javier García Blas Florin Isaila 1 Content Process creation. Process termination.

More information

238P: Operating Systems. Lecture 14: Process scheduling

238P: Operating Systems. Lecture 14: Process scheduling 238P: Operating Systems Lecture 14: Process scheduling This lecture is heavily based on the material developed by Don Porter Anton Burtsev November, 2017 Cooperative vs preemptive What is cooperative multitasking?

More information

Chapter 5 Scheduling

Chapter 5 Scheduling Chapter 5 Scheduling Images from Silberschatz Pacific University 1 Life time of a single process CPU usage/io bursts What would an IO bound process look like? What would a CPU bound process look like?

More information

Operating Systems. Lecture 05

Operating Systems. Lecture 05 Operating Systems Lecture 05 http://web.uettaxila.edu.pk/cms/sp2013/seosbs/ February 25, 2013 Process Scheduling, System Calls Execution (Fork,Wait,Exit,Exec), Inter- Process Communication Schedulers Long

More information

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

Assignment 3 (Due date: Thursday, 10/15/2009, in class) Part One: Provide brief answers to the following Chapter Exercises questions: Assignment 3 (Due date: Thursday, 10/15/2009, in class) Your name: Date: Part One: Provide brief answers to the following Chapter Exercises questions: 4.7 Provide two programming examples in which multithreading

More information

CPU Scheduling Algorithms

CPU Scheduling Algorithms CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating Systems Concepts with Java, by Silberschatz, Galvin, and Gagne (2007).

More information

But this will not be complete (no book covers 100%) So consider it a rough approximation Last lecture OSPP Sections 3.1 and 4.1

But this will not be complete (no book covers 100%) So consider it a rough approximation Last lecture OSPP Sections 3.1 and 4.1 ADRIAN PERRIG & TORSTEN HOEFLER ( 252-0062-00 ) Networks and Operating Systems Chapter 3: Scheduling Source: slashdot, Feb. 2014 Administrivia I will try to indicate book chapters But this will not be

More information

Properties of Processes

Properties of Processes CPU Scheduling Properties of Processes CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait. CPU burst distribution: CPU Scheduler Selects from among the processes that

More information

Recap. Run to completion in order of arrival Pros: simple, low overhead, good for batch jobs Cons: short jobs can stuck behind the long ones

Recap. Run to completion in order of arrival Pros: simple, low overhead, good for batch jobs Cons: short jobs can stuck behind the long ones Recap First-Come, First-Served (FCFS) Run to completion in order of arrival Pros: simple, low overhead, good for batch jobs Cons: short jobs can stuck behind the long ones Round-Robin (RR) FCFS with preemption.

More information

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems, 3rd edition. Uses content with permission from Assoc. Prof. Florin Fortis, PhD

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems, 3rd edition. Uses content with permission from Assoc. Prof. Florin Fortis, PhD OPERATING SYSTEMS #5 After A.S.Tanenbaum, Modern Operating Systems, 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD General information GENERAL INFORMATION Cooperating processes

More information

Problem Set: Processes

Problem Set: Processes Lecture Notes on Operating Systems Problem Set: Processes 1. Answer yes/no, and provide a brief explanation. (a) Can two processes be concurrently executing the same program executable? (b) Can two running

More information

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

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 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

More information

Killing Zombies, Working, Sleeping, and Spawning Children

Killing Zombies, Working, Sleeping, and Spawning Children Killing Zombies, Working, Sleeping, and Spawning Children CS 333 Prof. Karavanic (c) 2015 Karen L. Karavanic 1 The Process Model The OS loads program code and starts each job. Then it cleans up afterwards,

More information

Chapter 5: CPU Scheduling

Chapter 5: CPU Scheduling Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm Evaluation Chapter 5: CPU Scheduling

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 10 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 Chapter 6: CPU Scheduling Basic Concepts

More information

Scheduling, part 2. Don Porter CSE 506

Scheduling, part 2. Don Porter CSE 506 Scheduling, part 2 Don Porter CSE 506 Logical Diagram Binary Memory Formats Allocators Threads Today s Lecture Switching System to CPU Calls RCU scheduling File System Networking Sync User Kernel Memory

More information

Analyzing Real-Time Systems

Analyzing Real-Time Systems Analyzing Real-Time Systems Reference: Burns and Wellings, Real-Time Systems and Programming Languages 17-654/17-754: Analysis of Software Artifacts Jonathan Aldrich Real-Time Systems Definition Any system

More information

Operating System Concepts Ch. 5: Scheduling

Operating System Concepts Ch. 5: Scheduling Operating System Concepts Ch. 5: Scheduling Silberschatz, Galvin & Gagne Scheduling In a multi-programmed system, multiple processes may be loaded into memory at the same time. We need a procedure, or

More information

CS 326: Operating Systems. CPU Scheduling. Lecture 6

CS 326: Operating Systems. CPU Scheduling. Lecture 6 CS 326: Operating Systems CPU Scheduling Lecture 6 Today s Schedule Agenda? Context Switches and Interrupts Basic Scheduling Algorithms Scheduling with I/O Symmetric multiprocessing 2/7/18 CS 326: Operating

More information

Process a program in execution; process execution must progress in sequential fashion. Operating Systems

Process a program in execution; process execution must progress in sequential fashion. Operating Systems Process Concept An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks 1 Textbook uses the terms job and process almost interchangeably Process

More information

Chapter 5: CPU Scheduling

Chapter 5: CPU Scheduling COP 4610: Introduction to Operating Systems (Fall 2016) Chapter 5: CPU Scheduling Zhi Wang Florida State University Contents Basic concepts Scheduling criteria Scheduling algorithms Thread scheduling Multiple-processor

More information

1.1 CPU I/O Burst Cycle

1.1 CPU I/O Burst Cycle PROCESS SCHEDULING ALGORITHMS As discussed earlier, in multiprogramming systems, there are many processes in the memory simultaneously. In these systems there may be one or more processors (CPUs) but the

More information

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

B. V. Patel Institute of Business Management, Computer &Information Technology, UTU BCA-3 rd Semester 030010304-Fundamentals Of Operating Systems Unit: 1 Introduction Short Answer Questions : 1. State two ways of process communication. 2. State any two uses of operating system according

More information

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

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections ) CPU Scheduling CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections 6.7.2 6.8) 1 Contents Why Scheduling? Basic Concepts of Scheduling Scheduling Criteria A Basic Scheduling

More information

Operating Systems. Lecture Process Scheduling. Golestan University. Hossein Momeni

Operating Systems. Lecture Process Scheduling. Golestan University. Hossein Momeni Operating Systems Lecture 2.2 - Process Scheduling Golestan University Hossein Momeni momeni@iust.ac.ir Scheduling What is scheduling? Goals Mechanisms Scheduling on batch systems Scheduling on interactive

More information

Networks and Operating Systems ( ) Chapter 3: Scheduling

Networks and Operating Systems ( ) Chapter 3: Scheduling ADRIAN PERRIG & TORSTEN HOEFLER Networks and Operating Systems (252-0062-00) Chapter 3: Scheduling Source: slashdot, Feb. 2014 Many-to-one threads Early thread libraries Green threads (original Java VM)

More information

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

OPERATING SYSTEMS. UNIT II Sections A, B & D. An operating system executes a variety of programs: OPERATING SYSTEMS UNIT II Sections A, B & D PREPARED BY ANIL KUMAR PRATHIPATI, ASST. PROF., DEPARTMENT OF CSE. PROCESS CONCEPT An operating system executes a variety of programs: Batch system jobs Time-shared

More information

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

Lecture 17: Threads and Scheduling. Thursday, 05 Nov 2009 CS211: Programming and Operating Systems Lecture 17: Threads and Scheduling Thursday, 05 Nov 2009 CS211 Lecture 17: Threads and Scheduling 1/22 Today 1 Introduction to threads Advantages of threads 2 User

More information

Administrivia. Networks and Operating Systems ( ) Chapter 3: Scheduling. A Small Quiz. Last time. Scheduling.

Administrivia. Networks and Operating Systems ( ) Chapter 3: Scheduling. A Small Quiz. Last time. Scheduling. ADRIAN PERRIG & ORSEN HOEFLER Networks and Operating Systems (252-0062-00) Chapter 3: Scheduling Administrivia I try to indicate book chapters But this will not be complete (no book covers 100%) So consider

More information

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

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition Chapter 6: CPU Scheduling Silberschatz, Galvin and Gagne 2013 Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Real-Time

More information

csci3411: Operating Systems

csci3411: Operating Systems csci3411: Operating Systems Lecture 3: System structure and Processes Gabriel Parmer Some slide material from Silberschatz and West System Structure System Structure How different parts of software 1)

More information

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C.

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C. Structure Unix architecture users Functions of the System tools (shell, editors, compilers, ) standard library System call Standard library (printf, fork, ) OS kernel: processes, memory management, file

More information

CPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)

CPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s) 1/32 CPU Scheduling The scheduling problem: - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s) When do we make decision? 2/32 CPU Scheduling Scheduling decisions may take

More information

SE350: Operating Systems

SE350: Operating Systems SE350: Operating Systems Tutorial: The Programming Interface Main Points Creating and managing processes fork, exec, wait Example: implementing a shell Shell A shell is a job control system Allows programmer

More information

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

CSC 716 Advanced Operating System Fall 2007 Exam 1. Answer all the questions. The maximum credit for each question is as shown. CSC 716 Advanced Operating System Fall 2007 Exam 1 Answer all the questions. The maximum credit for each question is as shown. 1. (15) Multiple Choice(3 points for each): 1) Which of the following statement

More information

Processes & Threads. Recap of the Last Class. Layered Structure. Virtual Machines. CS 256/456 Dept. of Computer Science, University of Rochester

Processes & Threads. Recap of the Last Class. Layered Structure. Virtual Machines. CS 256/456 Dept. of Computer Science, University of Rochester Recap of the Last Class Processes & Threads CS 256/456 Dept. of Computer Science, University of Rochester Hardware protection kernel and mode System components process management, memory management, I/O

More information

Process Management! Goals of this Lecture!

Process Management! Goals of this Lecture! Process Management! 1 Goals of this Lecture! Help you learn about:" Creating new processes" Programmatically redirecting stdin, stdout, and stderr" (Appendix) communication between processes via pipes"

More information

Process- Concept &Process Scheduling OPERATING SYSTEMS

Process- Concept &Process Scheduling OPERATING SYSTEMS OPERATING SYSTEMS Prescribed Text Book Operating System Principles, Seventh Edition By Abraham Silberschatz, Peter Baer Galvin and Greg Gagne PROCESS MANAGEMENT Current day computer systems allow multiple

More information

What s An OS? Cyclic Executive. Interrupts. Advantages Simple implementation Low overhead Very predictable

What s An OS? Cyclic Executive. Interrupts. Advantages Simple implementation Low overhead Very predictable What s An OS? Provides environment for executing programs Process abstraction for multitasking/concurrency scheduling Hardware abstraction layer (device drivers) File systems Communication Do we need an

More information

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

CISC 7310X. C05: CPU Scheduling. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 3/1/2018 CUNY Brooklyn College CISC 7310X C05: CPU Scheduling Hui Chen Department of Computer & Information Science CUNY Brooklyn College 3/1/2018 CUNY Brooklyn College 1 Outline Recap & issues CPU Scheduling Concepts Goals and criteria

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 153 Design of Operating Systems Winter 2018 Midterm Review Midterm in class on Monday Covers material through scheduling and deadlock Based upon lecture material and modules of the book indicated on

More information

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

CPU Scheduling. Basic Concepts. Histogram of CPU-burst Times. Dispatcher. CPU Scheduler. Alternating Sequence of CPU and I/O Bursts CS307 Basic Concepts Maximize CPU utilization obtained with multiprogramming CPU Scheduling CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait CPU burst distribution

More information

Chapter 6: CPU Scheduling

Chapter 6: CPU Scheduling Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling

More information

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu CPSC 341 OS & Networks Processes Dr. Yingwu Zhu Process Concept Process a program in execution What is not a process? -- program on a disk A process is an active object, but a program is just a file It

More information

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

CPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013) CPU Scheduling Daniel Mosse (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013) Basic Concepts Maximum CPU utilization obtained with multiprogramming CPU I/O Burst Cycle Process

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 21

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 21 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2018 Lecture 21 LAST TIME: UNIX PROCESS MODEL Began to explore the implementation of the UNIX process model The user API is very simple: fork() creates a

More information

CS 3733 Operating Systems

CS 3733 Operating Systems What will be covered in MidtermI? CS 3733 Operating Systems Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio Basics of C programming language Processes, program

More information

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

Class average is Undergraduates are performing better. Working with low-level microcontroller timers Student feedback Low grades of the midterm exam Class average is 86.16 Undergraduates are performing better Cheat sheet on the final exam? You will be allowed to bring one page of cheat sheet to the final

More information

Implementing Scheduling Algorithms. Real-Time and Embedded Systems (M) Lecture 9

Implementing Scheduling Algorithms. Real-Time and Embedded Systems (M) Lecture 9 Implementing Scheduling Algorithms Real-Time and Embedded Systems (M) Lecture 9 Lecture Outline Implementing real time systems Key concepts and constraints System architectures: Cyclic executive Microkernel

More information

TDIU25: Operating Systems II. Processes, Threads and Scheduling

TDIU25: Operating Systems II. Processes, Threads and Scheduling TDIU25: Operating Systems II. Processes, Threads and Scheduling SGG9: 3.1-3.3, 4.1-4.3, 5.1-5.4 o Process concept: context switch, scheduling queues, creation o Multithreaded programming o Process scheduling

More information

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

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Week 05 Lecture 18 CPU Scheduling Hello. In this lecture, we

More information

Scheduling in the Supermarket

Scheduling in the Supermarket Scheduling in the Supermarket Consider a line of people waiting in front of the checkout in the grocery store. In what order should the cashier process their purchases? Scheduling Criteria CPU utilization

More information

Operating Systems Design Exam 1 Review: Spring 2012

Operating Systems Design Exam 1 Review: Spring 2012 Operating Systems Design Exam 1 Review: Spring 2012 Paul Krzyzanowski pxk@cs.rutgers.edu 1 Question 1 UNIX-derived systems execute new programs via a two-step process of fork and execve. Other systems

More information

EECS 482 Introduction to Operating Systems

EECS 482 Introduction to Operating Systems EECS 482 Introduction to Operating Systems Winter 2018 Harsha V. Madhyastha Recap: CPU Scheduling First Come First Serve (FCFS) Simple, but long waiting times for short jobs Round Robin Reduces waiting

More information

Operating Systems 2013/14 Assignment 3. Submission Deadline: Tuesday, December 17th, :30 a.m.

Operating Systems 2013/14 Assignment 3. Submission Deadline: Tuesday, December 17th, :30 a.m. Operating Systems 2013/14 Assignment 3 Prof. Dr. Frank Bellosa Dipl.-Inform. Marius Hillenbrand Dipl.-Inform. Marc Rittinghaus Submission Deadline: Tuesday, December 17th, 2013 9:30 a.m. In this assignment

More information

Multi-Level Feedback Queues

Multi-Level Feedback Queues CS 326: Operating Systems Multi-Level Feedback Queues Lecture 8 Today s Schedule Building an Ideal Scheduler Priority-Based Scheduling Multi-Level Queues Multi-Level Feedback Queues Scheduling Domains

More information

Operating Systems. Scheduling

Operating Systems. Scheduling Operating Systems Scheduling Process States Blocking operation Running Exit Terminated (initiate I/O, down on semaphore, etc.) Waiting Preempted Picked by scheduler Event arrived (I/O complete, semaphore

More information

COP 4610: Introduction to Operating Systems (Spring 2016) Chapter 3: Process. Zhi Wang Florida State University

COP 4610: Introduction to Operating Systems (Spring 2016) Chapter 3: Process. Zhi Wang Florida State University COP 4610: Introduction to Operating Systems (Spring 2016) Chapter 3: Process Zhi Wang Florida State University Contents Process concept Process scheduling Operations on processes Inter-process communication

More information

KEY CENG 334. Midterm. Question 1. Question 2. Question 3. Question 4. Question 5. Question 6. Total. Name, SURNAME and ID

KEY CENG 334. Midterm. Question 1. Question 2. Question 3. Question 4. Question 5. Question 6. Total. Name, SURNAME and ID 00 11 00 11 01 01 01 01 01 01 00 11 00 11 Name, SURNAME and ID Middle East Technical University Department of Computer Engineering KEY CENG 334 Section 2 and 3 Spring 2010-2011 Midterm Duration: 120 minutes.

More information

Homework Assignment #5

Homework Assignment #5 Homework Assignment #5 Question 1: Scheduling a) Which of the following scheduling algorithms could result in starvation? For those algorithms that could result in starvation, describe a situation in which

More information

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

EECE.4810/EECE.5730: Operating Systems Spring 2018 Programming Project 3 Due 11:59 PM, Wednesday, 4/18/18 Monday, 4/30/18 Spring 2018 Programming Project 3 Due 11:59 PM, Wednesday, 4/18/18 Monday, 4/30/18 1. Introduction This project uses simulation to explore the effectiveness of the different scheduling algorithms described

More information

Processes. CS3026 Operating Systems Lecture 05

Processes. CS3026 Operating Systems Lecture 05 Processes CS3026 Operating Systems Lecture 05 Dispatcher Admit Ready Queue Dispatch Processor Release Timeout or Yield Event Occurs Blocked Queue Event Wait Implementation: Using one Ready and one Blocked

More information

Operating Systems ECE344. Ding Yuan

Operating Systems ECE344. Ding Yuan Operating Systems ECE344 Ding Yuan Announcement & Reminder Midterm exam Will grade them this Friday Will post the solution online before next lecture Will briefly go over the common mistakes next Monday

More information

Process Management 1

Process Management 1 Process Management 1 Goals of this Lecture Help you learn about: Creating new processes Programmatically redirecting stdin, stdout, and stderr (Appendix) communication between processes via pipes Why?

More information

Titolo presentazione. Scheduling. sottotitolo A.Y Milano, XX mese 20XX ACSO Tutoring MSc Eng. Michele Zanella

Titolo presentazione. Scheduling. sottotitolo A.Y Milano, XX mese 20XX ACSO Tutoring MSc Eng. Michele Zanella Titolo presentazione Scheduling sottotitolo A.Y. 2017-18 Milano, XX mese 20XX ACSO Tutoring MSc Eng. Michele Zanella Process Scheduling Goals: Multiprogramming: having some process running at all times,

More information