Process Sheduling Lab
|
|
- Blaise Adams
- 6 years ago
- Views:
Transcription
1 Process Sheduling Lab CSCI411 Lab Inspired by Operating System Concepts, 8 th Edition, Silberschatz, Galvin, Gagne Adapted by M.D Doman 2013 Exercise Goal: You will learn more about how process management is designed, particularly how the scheduler is implemented. The scheduler is the heart of the multiprogramming system; it is responsible for choosing a new task to run whenever the CPU is available.you will learn how implement both a First-Come-First-Served process dispatcher, and, effectively, a Round-Robin dispatcher. Contents Introduction... 2 Problem Statement... 4 Problem Statement 1: First-Come-First Serve Process Dispatcher... 4 Problem Statement 1: RoundRobin Dispatcher... 5 Attacking the Problem... 5 First-Come-First Serve Process Dispatcher... 5 RoundRobin Dispatcher... 7 Process to be dispatched:... 7 fork() and exec() calls from shell program... 8 I/O Redirection... 9 Submission Requirements Appendix: Feedack Dispatcher Appendix: Fair-Share Scheduling Dispatcher... 12
2 Introduction Process management is the part of the OS that creates and destroys processes, provides mechanism for synchronization and multiplexes the CPU among runnable processes. This exercised considers the last part, focusing on the scheduler. Linux uses a different low-level view of how the OS is designed than the process model that appears at the system call interface. In this low-level view, when the hardware is started a single hardware process begins to run. After the Linux kernel has been loaded, the initial process is created (to use up all otherwise unused CPU cycles) and then Linux processes are started according to how the machine is configured to operate. For example, getty ( get teletype ) processes are started for each login port and daemons are started as specified. Thus, when the system is ready for normal operation, several processes are in existence, most of which are blocked on various conditions. The runnable tasks (those whose states are TASK_RUNNING) begin competing for the CPU. A fork() command defines a new kernel process. The initial process simply multiplexes among the programs that are loaded in different address spaces as it sees fit (and as defined by the task descriptor). That is, within the kernel, only one thread of execution exists that jumps from one runnable task to another. At the system call interface, this behavior has the appropriate UNIX process semantics. Process States The state field in the task descriptor can have any of the following values: TASK_RUNNING TASK_I NTERRU PTI BLE TASK_UNINTERRUPTIBLE TASK_ZOMBIE TASK_STOPPED As you go through the kernel code, you will often see statements of the form current-e-state = TASK_".; For example, in the sleep_on() code, state is set to TASK_UNINTERRUPTIBLE just before the process is placed on a wait queue. In wake_up(), state is set back to TASK_RUNNING after it is removed from the wait queue. Recall that the distinction between the TASK_INTERRUPTIBLE and TASK_UNINTERRUPTIBLE states relates to the sleeping task's ability to accept signals. TASK_ZOMBIE represents a state in which a process has terminated, but its parent has not yet performed a wait() system call to recognize that it has terminated. That is, the task does not disappear from the system until the parent is notified of its termination. The final possible value for the state field is TASK_STOPPED, which means that the task has been halted by a signal or through the ptrace mechanism. Thus most of the kernel code sets the state field to TASK_RUNNING, TASK_INTERRUPTIBLE, or TASK_UNINTERRUPTIBLE. Outside of the kernel, a different set of process states is visible to users. These states are defined by the POSIX rnodel rather than by the Linux implementation, though they are analogous to the internal states kept in the task descriptor. You can review these external states by inspecting the manual page for the STAT column in a ps command. The ps has three fields. ps FIELD 1: The first field may be one of the following: R: The process is running or runnable (its kernel state is TASK_RUNNING).
3 S: The process is sleeping (its kernel state is TASK_INTERRUPTIBLE). D: The process is in an uninterruptible sleep (its kernel state is TASK_ UNNTERRUPTIBLE). T: The process is either stopped or being traced (its kernel state is TASK_STOPPED). Z: The process is in the zombie state (its kernel state is TASK_ZOMBIE ps FIELD 2: The second field of ps is either blank, or W if the process currently has no pages loaded. The third field is either blank, or N if the process is running at a reduced priority. Most of the kernel code transitions the state of the process among TASK_RUNNING, TASK_INTERRUPTIBLE, and TASK_UNINTER- RUPTIBLE. Roughly speaking, whenever a process is to be blocked, it will be put on a queue (usually a wait queue) and its state will be changed to one of TASK_INTERRUPTIBLE or TASK_UNINTERRUPTIBLE and then the scheduler will be called. A task/process, when awakened, is removed from the wait queue and its state is changed to TASK_RUNNING. This leaves the scheduler as the final critical piece of process management that this manual considers. Scheduler Implementation The scheduler is a kernel function, schedule(), that gets called from various other system call functions (usually via sleep_on() ) and after every system call and slow interrupt. Each time that the scheduler is called, it does the following. 1. Performs various periodic work (such as running device bottom halves). 2. Inspects the set of tasks in the TASK_RUNNING state. 3. Chooses one task to execute according to the scheduling policy. 4. Dispatches the task to run on the CPU until an interrupt occurs. The scheduler contains three built-in scheduling strategies, identified by the constants SCHEDJIFO, SCHED_RR, and SCHED_OTHER. The scheduling policy for each process can be set at runtime by using the sched_setscheduler() system call (defined in kernel/sched.c). The task's current scheduling policy is saved in the policy field. The SCHED_FIFO and SCHED_RR policies are intended to be sensitive to real-time requirements, so they use scheduling priorities in the range [0:99], whereas SCHED_OTHER handles only the zero priority. Each process also has a priority field in its task descriptor. Conceptually, the scheduler has a multilevel queue with 100 levels (corresponding to the priorities from 0 to 99). Whenever a process with a priority that is higher than the currently running process becomes runnable, the lower-priority process is preempted and the higher-priority process begins to run. Of course, in the normal timesharing (SCHED_OTHER) policy, processes do not preempt one another, since they all have a priority of zero. Any task/process that uses the SCHED_FIFO policy must have superuser permission and have a priority of 1 to 99 (that is, it has a higher priority than all SCHED_OTHER tasks). Thus a SCHED_FIFO task that becomes runnable takes priority over every SCHED_OTHER task. The SCHED_FIFO policy does not reschedule on a timer interrupt. Once a SCHE SCHED_FIFO task gets control of the CPU, it will retain control until either it completes, blocks by an I/O call, calls sched_yield(), or until a higher priority task becomes runnable. If it yields or is preempted by another, higher-priority, task, it is placed at the end of the task queue at the same priority level. The SCHED_RR policy has the same general semantics as the SCHED_FIFO policy, except that it uses the timeslicing mechanism to multiplex the CPU among tasks that are in the highest-priority queue. A running SCHED_RR
4 task that is preempted by a higher-priority task is placed back on the head of its queue so that it will resume when its queue priority is again the highest in the system. The preempted process will then be allowed to complete its time quantum. The SCHED_OTHER policy is the default timesharing policy for Linux. It uses the conventional time-slicing mechanism (rescheduling on each timer interrupt) to put an upper bound on the amount of time that a task can use the CPU continuously if other tasks are waiting to use it. This policy ignores the static priorities used to discriminate among tasks in the other two policies. Instead, a dynamic priority is computed on the basis of the value assigned to the task by the nice() or setpriorty() system call and by the amount of time that a process has been waiting for the CPU to become available. Problem Statement Design a dispatcher that satisfies the criteria defined below. o o The dispatcher will be created as a child process from your shell program. To do this, you will replace the system() function call with fork() and exec() calls. Because the shell will be the session leader it will have control and access to the terminal input. The dispatcher must accept a file with list of the programs to dispatch.for the dispatcher process, redirect the stdin and stdout to files. Problem Statement 1: First-Come-First Serve Process Dispatcher Create a FCFS Dispatcher. This will be a shell program. An input file will associate an arrival time for each program so that execution of the program can not start until at least that time elapses. e.g. <arrival time>,program name, <priority>,<cputime> 0,P1,0,3 1 st Job: Arrival time 0, priority 0 (Real-Time), requiring 3 seconds of CPU time 2,P2,0,6 2 st Job: Arrival time 2, priority 0 (Real-Time), requiring 6 seconds of CPU time 4,P3,0,4 6,P4,0,5 8,P5,0,2 You will need to create a queue of job structures so that you only dequeue a job when the appropriate time has elapsed and there is no longer a current job running. (There is a guarantee that the jobs presented in the input dispatch file will be in chronological order of arrival).
5 Problem Statement 1: RoundRobin Dispatcher Try this with the following job list with a quantum of 1 sec: <arrival time>,program name, <priority>,<cputime> Round Robin Dispatcher (from Stallings) 0,P1,1,3 1 st Job: Arrival time 0, priority 1, requiring 3 seconds of CPU time 2,P2,1,6 2 st Job: Arrival time 2, priority 1, requiring 6 seconds of CPU time 4,P3,1,4 6,P4,1,5 8,P5,1,2 Attacking the Problem First-Come-First Serve Process Dispatcher The first thing to do is to define a process control block structure or class such as: struct pcb { pid_t pid; // system process ID char * args[maxargs]; // program name and args int arrivaltime; int remainingcputime; struct pcb * next; // links for PCB handlers }; typedef struct pcb PCB; typedef PCB * PcbPtr; This structure/class can be used for all the queues (linked lists) needed for the project (with a few extra elements in the structure). Dispatcher algorithm: The basic First-Come-First-Served (FCFS) dispatcher algorithm can be reduced to the following pseudo-code. Note that the tests may appear to be out of order (shouldn't one be doing the test at 4.i after the sleep rather than before it?). With the current model it makes no difference, but there are reasons for doing it in this order as we shall see when we come to the multiple dispatcher models later on.
6 1. Initialize dispatcher queue; 2. Fill dispatcher queue from dispatch list file; 3. Start dispatcher timer (dispatcher timer = 0); 4. While there's anything in the queue or there is a currently running process: i. If a process is currently running; a. Decrement process remainingcputime; b. If times up: A. Send SIGINT to the process to terminate it; B. Free up process structure memory ii. If no process currently running && dispatcher queue is not empty && arrivaltime of process at head of queue is <= dispatcher timer: a. Dequeue process and start it (fork & exec) b. Set it as currently running process; iii. sleep for one second; iv. Increment dispatcher timer; v. Go back to Exit. Be sure to include: #include <sys/types.h> and #include <signal.h> There are a number of ways to terminate a job. Since we know its process ID, the easiest way to do this is to send the process a terminating signal using the kill function. The one we need to use here is SIGINT, which is the equivalent of the Ctrl-C keyboard interrupt fielded by the shell. Use waitpid will check the termination of your child process. kill (pid, SIGINT); process_status = PCB_TERMINATED;
7 RoundRobin Dispatcher To suspend and restart processes as required by the Round Robin dispatcher will require the use of the SIGTSTP and SIGCONT signals as well as SIGINT that we used for the FCFS dispatcher.(see below). To make the Round Robin dispatcher work (RR q=1) the logic should be: 1. Initialize dispatcher queues (input queue and RR queue); 2. Fill input queue from dispatch list file; 3. Start dispatcher timer (dispatcher timer = 0); 4. While there's anything in any of the queues or there is a currently running process: i. Unload any pending processes from the input queue: While (head-of-input-queue.arrival-time <= dispatcher timer) dequeue process from input queue and enqueue on RR queue; ii. If a process is currently running: a. Decrement process remainingcputime; b. If times up: A. Send SIGINT to the process to terminate it; B. Free up process structure memory; c. else if other processes are waiting in RR queue: A. Send SIGTSTP to suspend it; B. Enqueue it back on RR queue; iii. If no process currently running && RR queue is not empty: a. Dequeue process from RR queue b. If already started but suspended, restart it (send SIGCONT to it) else start it (fork & exec) c. Set it as currently running process; iv. sleep for one second; v. Increment dispatcher timer; vi. Go back to Exit. or something like that! Try this with the following job list with a quantum of 1 sec: <arrival time>,program name, <priority>,<cputime> 0,P1,1,3 1 st Job: Arrival time 0, priority 1, requiring 3 seconds of CPU time 2,P2,1,6 2 st Job: Arrival time 2, priority 1, requiring 6 seconds of CPU time 4,P3,1,4 6,P4,1,5 8,P5,1,2 Process to be dispatched: The process to be dispatched can be as simple as the following. In fact, it can be the following. The idea is to have the process sleep for a period to ensure the process will run for an allotted time. The sleep function causes the calling
8 process to be suspended until either the amount of wall clock time specified by seconds has elapsed, or a signal is caught by the process and the signal handler returns. The return value from sleep is either 0 or the number of unslept seconds if the sleep has been interrupted by a signal interrupt. #include <iostream> #include <stdlib.h> #include <unistd.h> using namespace std; int main (int arg, char *argv[]) { int n = atoi(argv[2]); while (0 < n) { printf("process Executing: %s; PID: %lu\n, argv[1], (unsigned long)getpid()); sleep(1); n--; }// end of while }//end of main fork() and exec() calls from shell program Since we need to control what open files and file descriptors are passed the dispatcher, we need more control over there execution. To do this we need to use the fork and exec system calls. 1. In your Shell program, replace the use of system with fork and exec 2. You will now need to more fully parse the incoming command line so that you can set up the argument array (char *argv[] in the above examples). 3. You will find that while a system function call only returns after the program has finished, the use of fork means that two processes are now running in foreground. In most cases you will not want your shell to ask for the next command until the child process has finished. This can be accomplished using the wait or waitpid functions. e.g. switch (child_pid = fork()) { // error condition case -1: syserrmsg("fork",null); break; // I am the dispatcher (child) process case 0: execvp(args[0], args); syserrmsg("exec failed -",args[0]); exit(127); // I am the shell (parent) process default: if (!dont_wait) waitpid(pid, &status, WUNTRACED); Obviously, in the above example, if you wanted to run the child process 'in background', the flag dont_wait would be set and the shell would not wait for the child process to terminate.
9 I/O Redirection Your project shell must support I/O-redirection on both stdin and stdout. i.e. the command line: programname arg1 arg2 < inputfile > outputfile will execute the program programname with arguments arg1 and arg2, the stdin FILE stream replaced by inputfile and the stdout FILE stream replaced by outputfile. With output redirection, if the redirection character is > then the outputfile is created if it does not exist and truncated if it does. If the redirection token is >> then outputfile is created if it does not exist and appended to if it does. Note: you can assume that the redirection symbols, <, > & >> will be delimited from other command line arguments by white space - one or more spaces and/or tabs. This condition and the meanings for the redirection symbols outlined above and in the project differ from that for the standard shell. I/O redirection is accomplished in the child process immediately after the fork and before the exec command. At this point, the child has inherited all the file-handles of its parent and still has access to a copy of the parent memory. Thus, it will know if redirection is to be performed, and, if it does change the stdin and/or stdout file streams, this will only affect the child not the parent. The easiest way to do this is to use freopen. freopen opens a specified file on a specified stream, closing the stream first if it is already open. This function is typically used to open a specified file as one of the predefined streams, stdin, stdout, or stderr. Freopen ( filename, type, stdin/stdout/stderr) The type string is the standard open argument: type r or rb w or wb a or ab r+ or r+b or rb+ w+ or w+b or wb+ a+ or a+b or ab+ Description open for reading truncate to 0 length or create for writing append; open for writing at end of file, or create for writing open for reading and writing truncate to 0 length or create for reading and writing open or create for reading and writing at end of file where b as part of type allows the standard I/O system to differentiate between a text file and a binary file. Thus: freopen("inputfile", "r", stdin); would open the file inputfile and use it to replace the standard input stream, stdin.. ***********************************************************************/ switch (child_pid = fork()) { // error condition case -1: syserrmsg("fork",null); break; // I am the dispatcher (child) process case 0: // I/O redirection: stdin */ if (myinfile.txt) {
10 if (!freopen((myinfile.txt, "r", stdin)) errmsg((myinfile.txt,"can't be open for i/p redirect."); } if (myoutfile.txt) { if (!freopen(myoutfile.txt, sstatus.outmode, stdout)) errmsg(myoutfile.txt,"can't be open for o/p redirect."); } execvp(args[0], args); syserrmsg("exec failed -",args[0]); exit(127); // I am the shell (parent) process default: if (!dont_wait) waitpid(pid, &status, WUNTRACED); Submission Requirements Submit your source code (Shell script file) and makefile if necessary. Submit a lab report. This includes (from : 1. In a formal design document: a. Describe and discuss the structures or classes used by the dispatcher for queuing, dispatching and allocating memory and other resources. b. If your design required memory allocation: Describe and discuss what memory allocation algorithms you could have used and justify your final design choice. c. Describe and justify the overall structure of your program, describing the various modules and major functions (descriptions of the function 'interfaces' are expected). d. Discuss the possible use of a multilevel dispatching scheme, which would combine FCFS for realtime processes and RR or Feedback for prioritized processes. e. Include results from your run and an explanation or interpretation of the output. f. Diagram the flow of control (Gantt diagram) that illustrates the execution of the dispatched processes. g. Discuss turnaround time for each algorithm. 1. Determine (and show how it was calculated) the turnaround time of each process (i.e., how long was it in the system?) 2. Determine the average turnaround time. h. Include the source of our code. i. Include instructions on how to compile and run your code. The formal design document is expected to have in-depth discussions, descriptions and arguments.
11 Appendix: Feedack Dispatcher Having got the Round Robin dispatcher going, it is now a comparatively simple step to extend your code to make a multi-queue Three Level Feedback Dispatcher (from Stallings Fig 9.10) The logic is very similar to the previous exercise except that instead of enqueueing an incomplete process back onto the same (RR) queue that the process came from, the process is enqueued onto a lower priority process queue (if there is one to receive it). Obviously, the lowest priority queue operates in exactly the same way as a simple Round Robin queue. To make the Feedback dispatcher work in the same way as described in Stallings Figure 9.5 (Feedback q=1) the logic should be: 1. Initialize dispatcher queues (input queue and feedback queues); 2. Fill input queue from dispatch list file; 3. Start dispatcher timer (dispatcher timer = 0); 4. While there's anything in any of the queues or there is a currently running process: i. Unload pending processes from the input queue: While (head-of-input-queue.arrival-time <= dispatcher timer) dequeue process from input queue and enqueue on highest priority feedback queue (assigning it the appropriate priority); ii. If a process is currently running: a. Decrement process remainingcputime; b. If times up: A. Send SIGINT to the process to terminate it; B. Free up process structure memory; c. else if other processes are waiting in any of the feedback queues:
12 A. Send SIGTSTP to suspend it; B. Reduce the priority of the process (if possible) and enqueue it on the appropriate feedback queue iii. If no process currently running && feedback queues are not all empty: a. Dequeue a process from the highest priority feedback queue that is not empty b. If already started but suspended, restart it (send SIGCONT to it) else start it (fork & exec) c. Set it as currently running process; iv. sleep for one second; v. Increment dispatcher timer; vi. Go back to Exit. or something like that! As you can see, there is really not much difference between this and the Round Robin we completed last week. Try this with the following job list with a quantum of 1 sec: <arrival time>,program name, <priority>,<cputime> 0,P1,3,3 1 st Job: Arrival time 0, priority 1 (Real-Time), requiring 3 seconds of CPU time 2,P2,3,6 2 st Job: Arrival time 2, priority 1 (Real-Time), requiring 6 seconds of CPU time 4,P3,3,4 6,P4,3,5 8,P5,3,2 Appendix: Fair-Share Scheduling Dispatcher Fair-share scheduling [Bach, 1986] is a more abstract strategy for scheduling than any of the three built-in strategies. The idea is that the CPU should be shared among sets of processes according to the groups that own those processes. For example, suppose that Tom, Dick, and Harry belong to different groups and are logged in to a machine that uses fair-share scheduling. Further suppose that Tom has only one runnable process, Dick has three, and Harry has six. Fair-share scheduling calls for ten runnable processes and instead of each process getting 10 of the CPU cycles, the three groups each get one-third of the CPU cycles to allocate to the processes that they own. So Tom's single process would get 33 of the available CPU cycles, each of Dick's three processes would get about 11 of the available CPU cycles, and each of Harry's six processes would get about 5.5 of the CPU cycles. If Betty belonged to Dick's group and she logged in to the machine and created two more processes, then Tom's group would have one process but still receive one-third of the CPU cycles. Dick and Betty would have five processes and would be allocated one-third of the CPU cycles, distributed equally among their five processes, with each receiving about 6.7 of the total machine cycles. Each of Harry's six processes would continue to receive about 5.5 of the available CPU cycles.
Term Project Phase II: The Scheduler Ter m Proj ect Phas e II:
cse331 fall 2011 Term Project Phase II: The Scheduler Ter m Proj ect Phas e II: Goal: You will Iearn more about how process management is designed, particularly how the scheduler is implemented. The scheduler
More informationChapter 6: CPU Scheduling
Chapter 6: CPU Scheduling Silberschatz, Galvin and Gagne Histogram of CPU-burst Times 6.2 Silberschatz, Galvin and Gagne Alternating Sequence of CPU And I/O Bursts 6.3 Silberschatz, Galvin and Gagne CPU
More informationProcesses. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Processes Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu OS Internals User space shell ls trap shell ps Kernel space File System Management I/O
More informationKilling 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 informationCS370 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 informationChapter 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 informationLecture 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 informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 9 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 CPU Scheduling: Objectives CPU scheduling,
More informationProcesses. 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 informationCSC 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 informationCS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 20
CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2018 Lecture 20 LAST TIME: UNIX PROCESS MODEL Began covering the UNIX process model and API Information associated with each process: A PID (process ID) to
More informationChapter 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 informationCSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476
CSE 451: Operating Systems Winter 2015 Module 4 Processes Mark Zbikowski mzbik@cs.washington.edu Allen Center 476 2013 Gribble, Lazowska, Levy, Zahorjan Process management This module begins a series of
More informationProcesses. 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 informationChapter 5: CPU Scheduling. Operating System Concepts Essentials 8 th Edition
Chapter 5: CPU Scheduling Silberschatz, Galvin and Gagne 2011 Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating
More informationChapter 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 informationSMD149 - Operating Systems
SMD149 - Operating Systems Roland Parviainen November 3, 2005 1 / 45 Outline Overview 2 / 45 Process (tasks) are necessary for concurrency Instance of a program in execution Next invocation of the program
More informationINF1060: 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 informationScheduling. Scheduling 1/51
Scheduling 1/51 Learning Objectives Scheduling To understand the role of a scheduler in an operating system To understand the scheduling mechanism To understand scheduling strategies such as non-preemptive
More informationCHAPTER 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 informationProject No. 2: Process Scheduling in Linux Submission due: April 12, 2013, 11:59pm
Project No. 2: Process Scheduling in Linux Submission due: April 12, 2013, 11:59pm PURPOSE Getting familiar with the Linux kernel source code. Understanding process scheduling and how different parameters
More informationLecture 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 informationCreating a Shell or Command Interperter Program CSCI411 Lab
Creating a Shell or Command Interperter Program CSCI411 Lab Adapted from Linux Kernel Projects by Gary Nutt and Operating Systems by Tannenbaum Exercise Goal: You will learn how to write a LINUX shell
More informationPROCESSES. Jo, Heeseung
PROCESSES Jo, Heeseung TODAY'S TOPICS What is the process? How to implement processes? Inter-Process Communication (IPC) 2 WHAT IS THE PROCESS? Program? vs. Process? vs. Processor? 3 PROCESS CONCEPT (1)
More informationProcesses. Jo, Heeseung
Processes Jo, Heeseung Today's Topics What is the process? How to implement processes? Inter-Process Communication (IPC) 2 What Is The Process? Program? vs. Process? vs. Processor? 3 Process Concept (1)
More informationOperating System Structure
Operating System Structure CSCI 4061 Introduction to Operating Systems Applications Instructor: Abhishek Chandra Operating System Hardware 2 Questions Operating System Structure How does the OS manage
More informationProblem 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 informationCSE 410: Computer Systems Spring Processes. John Zahorjan Allen Center 534
CSE 410: Computer Systems Spring 2018 Processes John Zahorjan zahorjan@cs.washington.edu Allen Center 534 1. What is a process? Processes 2. What's the process namespace? 3. How are processes represented
More informationProcesses. 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 informationScheduling. Scheduling 1/51
Scheduling 1/51 Scheduler Scheduling Scheduler allocates cpu(s) to threads and processes. This action is known as scheduling. The scheduler is a part of the process manager code that handles scheduling.
More informationProcess management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized)
Process management CSE 451: Operating Systems Spring 2012 Module 4 Processes Ed Lazowska lazowska@cs.washington.edu Allen Center 570 This module begins a series of topics on processes, threads, and synchronization
More informationProcesses, Context Switching, and Scheduling. Kevin Webb Swarthmore College January 30, 2018
Processes, Context Switching, and Scheduling Kevin Webb Swarthmore College January 30, 2018 Today s Goals What is a process to the OS? What are a process s resources and how does it get them? In particular:
More informationSignals, Synchronization. CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han
, Synchronization CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han Announcements Program Assignment #1 due Tuesday Feb. 15 at 11:55 pm TA will explain parts b-d in recitation Read chapters 7 and
More informationCPU 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 informationProcesses, PCB, Context Switch
THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE 272 CAOS Operating Systems Part II Processes, PCB, Context Switch Instructor Dr. M. Sakalli enmsaka@eie.polyu.edu.hk
More informationComputer Systems II. First Two Major Computer System Evolution Steps
Computer Systems II Introduction to Processes 1 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent processes) 2 1 At First (1945 1955) In the beginning,
More informationCPU 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 informationProblem 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 informationPROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo
PROCESS MANAGEMENT Operating Systems 2015 Spring by Euiseong Seo Today s Topics Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication
More informationOperating Systems. Figure: Process States. 1 P a g e
1. THE PROCESS CONCEPT A. The Process: A process is a program in execution. A process is more than the program code, which is sometimes known as the text section. It also includes the current activity,
More informationCPU 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(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 informationClass 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 informationUnix Processes. What is a Process?
Unix Processes Process -- program in execution shell spawns a process for each command and terminates it when the command completes Many processes all multiplexed to a single processor (or a small number
More informationProcesses 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 informationPROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)
MANAGEMENT OF APPLICATION EXECUTION PROCESS CONTROL BLOCK Resources (processor, I/O devices, etc.) are made available to multiple applications The processor in particular is switched among multiple applications
More informationProperties 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 informationChapter 5 CPU scheduling
Chapter 5 CPU scheduling Contents Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling
More informationPROGRAMMING PROJECT ONE DEVELOPING A SHELL
PROGRAMMING PROJECT ONE DEVELOPING A SHELL William Stallings Copyright 2011 Supplement to Operating Systems, Seventh Edition Prentice Hall 2011 ISBN: 013230998X http://williamstallings.com/os/os7e.html
More informationChapter 5: CPU Scheduling. Operating System Concepts 9 th Edit9on
Chapter 5: CPU Scheduling Operating System Concepts 9 th Edit9on Silberschatz, Galvin and Gagne 2013 Chapter 6: CPU Scheduling 1. Basic Concepts 2. Scheduling Criteria 3. Scheduling Algorithms 4. Thread
More informationCSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song
CSCE 313 Introduction to Computer Systems Instructor: Dezhen Song Programs, Processes, and Threads Programs and Processes Threads Programs, Processes, and Threads Programs and Processes Threads Processes
More informationCSCE 313: Intro to Computer Systems
CSCE 313 Introduction to Computer Systems Instructor: Dr. Guofei Gu http://courses.cse.tamu.edu/guofei/csce313/ Programs, Processes, and Threads Programs and Processes Threads 1 Programs, Processes, and
More informationCh 4 : CPU scheduling
Ch 4 : CPU scheduling It's the basis of multiprogramming operating systems. By switching the CPU among processes, the operating system can make the computer more productive In a single-processor system,
More informationChapter 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
More informationChap 4, 5: Process. Dongkun Shin, SKKU
Chap 4, 5: Process 1 Process Concept Job A bundle of program and data to be executed An entity before submission for execution Process (= running program) An entity that is registered to kernel for execution
More informationCPSC 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 informationOPERATING 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 informationHigh level scheduling: Medium level scheduling: Low level scheduling. Scheduling 0 : Levels
Scheduling 0 : Levels High level scheduling: Deciding whether another process can run is process table full? user process limit reached? load to swap space or memory? Medium level scheduling: Balancing
More informationMon 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 informationReading 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 informationChapter 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 informationProcesses & Signals. System Runs Many Processes Concurrently. State consists of memory image + register values + program counter
Processes & Signals Topics Process Hierarchy Shells Signals The World of Multitasking System Runs Many Processes Concurrently Process: executing program State consists of memory image + register values
More informationComputer 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* What are the different states for a task in an OS?
* Kernel, Services, Libraries, Application: define the 4 terms, and their roles. The kernel is a computer program that manages input/output requests from software, and translates them into data processing
More informationSE350: 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 informationChapter 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 informationGetting 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 informationProcesses. What s s a process? process? A dynamically executing instance of a program. David Morgan
Processes David Morgan What s s a process? process? A dynamically executing instance of a program 1 Constituents of a process its code data various attributes OS needs to manage it OS keeps track of all
More informationUnit 3 : Process Management
Unit : Process Management Processes are the most widely used units of computation in programming and systems, although object and threads are becoming more prominent in contemporary systems. Process management
More information5/8/2012. Controlling User Processes Chapter 10
Controlling User Processes Chapter 10 To describe the concept of a process, and execution of multiple processes on a computer system with a single CPU To explain how a shell executes commands To discuss
More informationChapter 3: Process Concept
Chapter 3: Process Concept Silberschatz, Galvin and Gagne 2013! Chapter 3: Process Concept Process Concept" Process Scheduling" Operations on Processes" Inter-Process Communication (IPC)" Communication
More informationOPERATING 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 informationCS370 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 informationProcess- 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 informationMultitasking. Programmer s model of multitasking. fork() spawns new process. exit() terminates own process
Signals Prof. Jin-Soo Kim( jinsookim@skku.edu) TA JinHong Kim( jinhong.kim@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Multitasking Programmer s model of multitasking
More informationCS 326: Operating Systems. Process Execution. Lecture 5
CS 326: Operating Systems Process Execution Lecture 5 Today s Schedule Process Creation Threads Limited Direct Execution Basic Scheduling 2/5/18 CS 326: Operating Systems 2 Today s Schedule Process Creation
More informationSignals. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Signals Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Multitasking (1) Programmer s model of multitasking fork() spawns new process Called once,
More informationLinux Kernel PROCESS. Copyrighted to
Linux Kernel PROCESS 1 Copyrighted to www.suvenconsultants.com Process : a running program. Individual processes exist independently alongside each other and cannot affect each other directly. Each process
More informationProcesses in linux. What s s a process? process? A dynamically executing instance of a program. David Morgan. David Morgan
Processes in linux David Morgan What s s a process? process? A dynamically executing instance of a program 1 Constituents of a process its code data various attributes OS needs to manage it OS keeps track
More informationProcesses Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved.
Processes Prof. James L. Frankel Harvard University Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved. Process Model Each process consists of a sequential program
More informationCS 4410, Fall 2017 Project 1: My First Shell Assigned: August 27, 2017 Due: Monday, September 11:59PM
CS 4410, Fall 2017 Project 1: My First Shell Assigned: August 27, 2017 Due: Monday, September 11th @ 11:59PM Introduction The purpose of this assignment is to become more familiar with the concepts of
More informationComparison of soft real-time CPU scheduling in Linux kernel 2.6 series with Solaris 10
Comparison of soft real-time CPU scheduling in Linux kernel 2.6 series with Solaris 10 Kristoffer Eriksson Philip Frising Department of Computer and Information Science Linköping University 1(15) 1. About
More informationCS3733: Operating Systems
CS3733: Operating Systems Topics: Process (CPU) Scheduling (SGG 5.1-5.3, 6.7 and web notes) Instructor: Dr. Dakai Zhu 1 Updates and Q&A Homework-02: late submission allowed until Friday!! Submit on Blackboard
More informationOperating 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 informationProgramming Assignments will be.. All the PAs are continuous 3 major factors that you should consider
Signals Prof. Jin-Soo Kim( jinsookim@skku.edu) TA - Dong-Yun Lee (dylee@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu NOTICE Programming Assignments will be.. All
More informationAnnouncement. Exercise #2 will be out today. Due date is next Monday
Announcement Exercise #2 will be out today Due date is next Monday Major OS Developments 2 Evolution of Operating Systems Generations include: Serial Processing Simple Batch Systems Multiprogrammed Batch
More informationby Marina Cholakyan, Hyduke Noshadi, Sepehr Sahba and Young Cha
CS 111 Scribe Notes for 4/11/05 by Marina Cholakyan, Hyduke Noshadi, Sepehr Sahba and Young Cha Processes What is a process? A process is a running instance of a program. The Web browser you're using to
More informationCS 31: Intro to Systems Processes. Kevin Webb Swarthmore College March 31, 2016
CS 31: Intro to Systems Processes Kevin Webb Swarthmore College March 31, 2016 Reading Quiz Anatomy of a Process Abstraction of a running program a dynamic program in execution OS keeps track of process
More informationOPERATING SYSTEMS. COMS W1001 Introduction to Information Science. Boyi Xie
1 OPERATING SYSTEMS COMS W1001 Introduction to Information Science Boyi Xie 2 Announcement Homework 1 is available Grace days A total of 5 days for 5 HWs If all grace days have been used, 50% of the points
More informationOperating 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 informationChapter 5 Process Scheduling
Chapter 5 Process Scheduling Da-Wei Chang CSIE.NCKU Source: Abraham Silberschatz, Peter B. Galvin, and Greg Gagne, "Operating System Concepts", 9th Edition, Wiley. 1 Outline Basic Concepts Scheduling Criteria
More informationChapter 5: Process Scheduling
Chapter 5: Process Scheduling Chapter 5: Process Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Thread Scheduling Operating Systems Examples Algorithm
More informationLecture Topics. Announcements. Today: Uniprocessor Scheduling (Stallings, chapter ) Next: Advanced Scheduling (Stallings, chapter
Lecture Topics Today: Uniprocessor Scheduling (Stallings, chapter 9.1-9.3) Next: Advanced Scheduling (Stallings, chapter 10.1-10.4) 1 Announcements Self-Study Exercise #10 Project #8 (due 11/16) Project
More information518 Lecture Notes Week 3
518 Lecture Notes Week 3 (Sept. 15, 2014) 1/8 518 Lecture Notes Week 3 1 Topics Process management Process creation with fork() Overlaying an existing process with exec Notes on Lab 3 2 Process management
More informationLecture Topics. Announcements. Today: Threads (Stallings, chapter , 4.6) Next: Concurrency (Stallings, chapter , 5.
Lecture Topics Today: Threads (Stallings, chapter 4.1-4.3, 4.6) Next: Concurrency (Stallings, chapter 5.1-5.4, 5.7) 1 Announcements Make tutorial Self-Study Exercise #4 Project #2 (due 9/20) Project #3
More informationChapter 5: CPU Scheduling. Operating System Concepts 8 th Edition,
Chapter 5: CPU Scheduling Operating System Concepts 8 th Edition, Hanbat National Univ. Computer Eng. Dept. Y.J.Kim 2009 Chapter 5: Process Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms
More informationProject 2: CPU Scheduling Simulator
Project 2: CPU Scheduling Simulator CSCI 442, Spring 2017 Assigned Date: March 2, 2017 Intermediate Deliverable 1 Due: March 10, 2017 @ 11:59pm Intermediate Deliverable 2 Due: March 24, 2017 @ 11:59pm
More informationCS307: Operating Systems
CS307: Operating Systems Chentao Wu 吴晨涛 Associate Professor Dept. of Computer Science and Engineering Shanghai Jiao Tong University SEIEE Building 3-513 wuct@cs.sjtu.edu.cn Download Lectures ftp://public.sjtu.edu.cn
More informationSignals: Management and Implementation. Sanjiv K. Bhatia Univ. of Missouri St. Louis
Signals: Management and Implementation Sanjiv K. Bhatia Univ. of Missouri St. Louis sanjiv@aryabhat.umsl.edu http://www.cs.umsl.edu/~sanjiv Signals Mechanism to notify processes of asynchronous events
More informationCS 213, Fall 2002 Lab Assignment L5: Writing Your Own Unix Shell Assigned: Oct. 24, Due: Thu., Oct. 31, 11:59PM
CS 213, Fall 2002 Lab Assignment L5: Writing Your Own Unix Shell Assigned: Oct. 24, Due: Thu., Oct. 31, 11:59PM Harry Bovik (bovik@cs.cmu.edu) is the lead person for this assignment. Introduction The purpose
More information