CPU Scheduling (Part II)

Size: px
Start display at page:

Download "CPU Scheduling (Part II)"

Transcription

1 CPU Scheduling (Part II) Amir H. Payberah Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 1 / 58

2 Motivation Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 2 / 58

3 Reminder CPU scheduling is the basis of multiprogrammed OSs. By switching the CPU among processes, the OS makes the computer more productive. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 3 / 58

4 Basic Concepts In a single-processor system, only one process can run at a time. Others must wait until the CPU is free and can be rescheduled. The objective of multiprogramming is to have some process running at all times, to maximize CPU utilization. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 4 / 58

5 Scheduling Criteria CPU utilization Throughput Turnaround time Waiting time Response time Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 5 / 58

6 Process Scheduling Algorithms First-Come, First-Served Scheduling Shortest-Job-First Scheduling Priority Scheduling Round-Robin Scheduling Multilevel Queue Scheduling Multilevel Feedback Queue Scheduling Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 6 / 58

7 Thread Scheduling Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 7 / 58

8 Thread Scheduling (1/2) Distinction between user-level and kernel-level threads. When threads supported by the OS, threads scheduled, not processes. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 8 / 58

9 Thread Scheduling (2/2) Process-Contention Scope (PCS) In many-to-one and many-to-many models Scheduling competition is within the process. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 9 / 58

10 Thread Scheduling (2/2) Process-Contention Scope (PCS) In many-to-one and many-to-many models Scheduling competition is within the process. System-Contention Scope (SCS) In one-to-one model. Scheduling competition among all threads in system. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 9 / 58

11 Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 10 / 58

12 Pthread Scheduling API allows specifying either PCS or SCS during thread creation. PTHREAD SCOPE PROCESS schedules threads using PCS scheduling. PTHREAD SCOPE SYSTEM schedules threads using SCS scheduling. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 11 / 58

13 Contention Scope pthread attr setscope and pthread attr getscope set/get contention scope attribute in thread attributes object. #include <pthread.h> int pthread_attr_setscope(pthread_attr_t *attr, int scope); int pthread_attr_getscope(const pthread_attr_t *attr, int *scope); Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 12 / 58

14 Pthread Scheduling API (1/2) #include <pthread.h> #include <stdio.h> #define NUM_THREADS 5 int main(int argc, char *argv[]) { int i, scope; pthread_t tid[num THREADS]; pthread_attr_t attr; /* get the default attributes */ pthread_attr_init(&attr); /* first inquire on the current scope */ if (pthread_attr_getscope(&attr, &scope)!= 0) fprintf(stderr, "Unable to get scheduling scope\n"); else { if (scope == PTHREAD_SCOPE_PROCESS) printf("pthread_scope_process"); else if (scope == PTHREAD_SCOPE_SYSTEM) printf("pthread_scope_system"); else fprintf(stderr, "Illegal scope value.\n"); } Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 13 / 58

15 Pthread Scheduling API (2/2) /* set the scheduling algorithm to PCS or SCS */ pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); /* create the threads */ for (i = 0; i < NUM_THREADS; i++) pthread_create(&tid[i], &attr, runner, NULL); /* now join on each thread */ for (i = 0; i < NUM_THREADS; i++) pthread_join(tid[i], NULL); } /* Each thread will begin control in this function */ void *runner(void *param) { /* do some work... */ pthread_exit(0); } Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 14 / 58

16 Multi-Processor Scheduling Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 15 / 58

17 Multiple-Processor Scheduling CPU scheduling is more complex when multiple CPUs are available. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 16 / 58

18 Multiple-Processor Scheduling CPU scheduling is more complex when multiple CPUs are available. Asymmetric multiprocessing Only one processor does all scheduling decisions, I/O processing, and other system activities. The other processors execute only user code. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 16 / 58

19 Multiple-Processor Scheduling CPU scheduling is more complex when multiple CPUs are available. Asymmetric multiprocessing Only one processor does all scheduling decisions, I/O processing, and other system activities. The other processors execute only user code. Symmetric multiprocessing (SMP) Each processor is self-scheduling All processes in common ready queue, or each has its own private queue of ready processes. Currently, the most common. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 16 / 58

20 Processor Affinity What happens to cache memory when a process has been running on a specific processor, and then, the process migrates to another processor? Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 17 / 58

21 Processor Affinity What happens to cache memory when a process has been running on a specific processor, and then, the process migrates to another processor? Invalidating and repopulating caches is costly. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 17 / 58

22 Processor Affinity What happens to cache memory when a process has been running on a specific processor, and then, the process migrates to another processor? Invalidating and repopulating caches is costly. Processor affinity: keep a process running on the same processor. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 17 / 58

23 Processor Affinity What happens to cache memory when a process has been running on a specific processor, and then, the process migrates to another processor? Invalidating and repopulating caches is costly. Processor affinity: keep a process running on the same processor. Soft affinity: the OS attempts to keep a process on a single processor, but it is possible for a process to migrate between processors. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 17 / 58

24 Processor Affinity What happens to cache memory when a process has been running on a specific processor, and then, the process migrates to another processor? Invalidating and repopulating caches is costly. Processor affinity: keep a process running on the same processor. Soft affinity: the OS attempts to keep a process on a single processor, but it is possible for a process to migrate between processors. Hard affinity: allowing a process to specify a subset of processors on which it may run. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 17 / 58

25 NUMA and CPU Scheduling Non-Uniform Memory Access (NUMA): a CPU has faster access to some parts of main memory than to other parts. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 18 / 58

26 NUMA and CPU Scheduling Non-Uniform Memory Access (NUMA): a CPU has faster access to some parts of main memory than to other parts. Systems containing combined CPU and memory boards. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 18 / 58

27 NUMA and CPU Scheduling Non-Uniform Memory Access (NUMA): a CPU has faster access to some parts of main memory than to other parts. Systems containing combined CPU and memory boards. A process that is assigned affinity to a particular CPU can be allocated memory on the board where that CPU resides. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 18 / 58

28 Load Balancing If SMP, need to keep all CPUs loaded for efficiency. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 19 / 58

29 Load Balancing If SMP, need to keep all CPUs loaded for efficiency. Load balancing attempts to keep workload evenly distributed. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 19 / 58

30 Load Balancing If SMP, need to keep all CPUs loaded for efficiency. Load balancing attempts to keep workload evenly distributed. Push migration: periodic task checks load on each processor, and if found pushes task from overloaded CPU to other CPUs. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 19 / 58

31 Load Balancing If SMP, need to keep all CPUs loaded for efficiency. Load balancing attempts to keep workload evenly distributed. Push migration: periodic task checks load on each processor, and if found pushes task from overloaded CPU to other CPUs. Pull migration: idle processors pulls waiting task from busy processor. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 19 / 58

32 Multicore Processors Place multiple processor cores on same physical chip. Faster and consumes less power. Memory stall: when a processor accesses memory, it spends a significant amount of time waiting for the data to become available. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 20 / 58

33 Multithreaded Multicore System Multiple threads per core also growing. Takes advantage of memory stall to make progress on another thread while memory retrieve happens. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 21 / 58

34 Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 22 / 58

35 CPU Affinity sched setaffinity() and sched getaffinity() sets/gets the CPU affinity of the process specified by pid. #define _GNU_SOURCE #include <sched.h> int sched_setaffinity(pid_t pid, size_t len, cpu_set_t *set); int sched_getaffinity(pid_t pid, size_t len, cpu_set_t *set); Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 23 / 58

36 CPU Affinity Macros CPU ZERO() initializes set to be empty. CPU SET() adds the CPU cpu to set. CPU CLR() removes the CPU cpu from set. CPU ISSET() returns true if the CPU cpu is a member of set. #define _GNU_SOURCE #include <sched.h> void CPU_ZERO(cpu_set_t *set); void CPU_SET(int cpu, cpu_set_t *set); void CPU_CLR(int cpu, cpu_set_t *set); int CPU_ISSET(int cpu, cpu_set_t *set); Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 24 / 58

37 CPU Affinity Macros The process identified by pid runs on any CPU other than the first CPU of a four-processor system. cpu_set_t set; CPU_ZERO(&set); CPU_SET(1, &set); CPU_SET(2, &set); CPU_SET(3, &set); sched_setaffinity(pid, sizeof(set), &set); Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 25 / 58

38 Real-Time CPU Scheduling Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 26 / 58

39 Minimizing Latency When an event occurs, the system must respond to and service it as quickly as possible. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 27 / 58

40 Minimizing Latency When an event occurs, the system must respond to and service it as quickly as possible. Event latency: the amount of time that elapses from when an event occurs to when it is serviced. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 27 / 58

41 Soft vs. Hard Real-Time Soft real-time No guarantee as to when a critical real-time process will be scheduled. They guarantee only that the process will be given preference over noncritical processes. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 28 / 58

42 Soft vs. Hard Real-Time Soft real-time No guarantee as to when a critical real-time process will be scheduled. They guarantee only that the process will be given preference over noncritical processes. Hard real-time The task must be serviced by its deadline. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 28 / 58

43 Real-Time CPU Scheduling (1/2) Two types of latencies affect performance: 1 Interrupt latency: time from arrival of interrupt to start of routine that services interrupt. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 29 / 58

44 Real-Time CPU Scheduling (1/2) Two types of latencies affect performance: 1 Interrupt latency: time from arrival of interrupt to start of routine that services interrupt. 2 Dispatch latency: time for schedule to take current process off CPU and switch to another. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 29 / 58

45 Real-Time CPU Scheduling (2/2) Conflict phase of dispatch latency: 1 Preemption of any process running in kernel mode. 2 Release by low-priority process of resources needed by high-priority processes. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 30 / 58

46 Periodic Processes Periodic processes require CPU at constant intervals. Processing time t, deadline d, period p 0 t d p Rate of periodic task is 1 p Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 31 / 58

47 Priority-Based Scheduling Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 32 / 58

48 Priority-Based Scheduling For real-time scheduling, scheduler must support preemptive and priority-based scheduling. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 33 / 58

49 Priority-Based Scheduling For real-time scheduling, scheduler must support preemptive and priority-based scheduling. Only guarantees soft real-time. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 33 / 58

50 Priority-Based Scheduling For real-time scheduling, scheduler must support preemptive and priority-based scheduling. Only guarantees soft real-time. For hard real-time must also provide ability to meet deadlines. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 33 / 58

51 Rate-Monotonic Scheduling Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 34 / 58

52 Rate-Monotonic Scheduling A priority is assigned based on the inverse of its period. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 35 / 58

53 Rate-Monotonic Scheduling A priority is assigned based on the inverse of its period. Shorter periods = higher priority Longer periods = lower priority Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 35 / 58

54 Rate-Monotonic Scheduling A priority is assigned based on the inverse of its period. Shorter periods = higher priority Longer periods = lower priority Assign a higher priority to tasks that require the CPU more often. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 35 / 58

55 Rate-Monotonic Example 1 (1/4) Two processes: P 1 and P 2 p 1 = 50 and p 2 = 100 t 1 = 20 and t 2 = 35 d 1 = d 2 = complete its CPU burst by the start of its next period Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 36 / 58

56 Rate-Monotonic Example 1 (2/4) Is it possible to schedule these tasks so that each meets its deadlines? Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 37 / 58

57 Rate-Monotonic Example 1 (2/4) Is it possible to schedule these tasks so that each meets its deadlines? Measure the CPU utilization: t i p i Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 37 / 58

58 Rate-Monotonic Example 1 (2/4) Is it possible to schedule these tasks so that each meets its deadlines? Measure the CPU utilization: t i p i t 1 p 1 = = 0.4 t 2 p 2 = = 0.35 Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 37 / 58

59 Rate-Monotonic Example 1 (2/4) Is it possible to schedule these tasks so that each meets its deadlines? Measure the CPU utilization: t i p i t 1 p 1 = = 0.4 t 2 p 2 = = % + 35% < 100% Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 37 / 58

60 Rate-Monotonic Example 1 (3/4) Suppose we assign P 2 a higher priority than P 1. P1 misses its deadline. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 38 / 58

61 Rate-Monotonic Example 1 (4/4) Suppose we assign P 1 a higher priority than P 2. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 39 / 58

62 Rate-Monotonic Example 2 (1/3) Two processes: P 1 and P 2 p 1 = 50 and p 2 = 80 t 1 = 25 and t 2 = 35 d 1 = d 2 = complete its CPU burst by the start of its next period Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 40 / 58

63 Rate-Monotonic Example 2 (2/3) Is it possible to schedule these tasks so that each meets its deadlines? Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 41 / 58

64 Rate-Monotonic Example 2 (2/3) Is it possible to schedule these tasks so that each meets its deadlines? t 1 p 1 = = 0.5 t 2 p 2 = = % + 44% < 100% Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 41 / 58

65 Rate-Monotonic Example 2 (3/3) Suppose we assign P 1 a higher priority than P 2. P2 misses its deadline. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 42 / 58

66 Earliest-Deadline-First (EDF) Scheduling Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 43 / 58

67 Earliest Deadline First Scheduling Priorities are assigned according to deadlines. The earlier the deadline, the higher the priority. The later the deadline, the lower the priority. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 44 / 58

68 EDF Example (1/3) Two processes: P 1 and P 2 p 1 = 50 and p 2 = 80 t 1 = 25 and t 2 = 35 d 1 = d 2 = complete its CPU burst by the start of its next period Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 45 / 58

69 EDF Example (2/3) Is it possible to schedule these tasks so that each meets its deadlines? Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 46 / 58

70 EDF Example (2/3) Is it possible to schedule these tasks so that each meets its deadlines? t 1 p 1 = = 0.5 t 2 p 2 = = % + 44% < 100% Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 46 / 58

71 EDF Example (3/3) Suppose we assign P 1 a higher priority than P 2. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 47 / 58

72 Proportional Share Scheduling Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 48 / 58

73 Proportional Share Scheduling T shares are allocated among all processes in the system. An application receives N shares where N < T. This ensures each application will receive N T time. of the total processor Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 49 / 58

74 Proportional Share Example Three processes: P 1, P 2, and P 3 T = 100 P 1 is assigned 50, P 2 is assigned 15, and P 3 is assigned 20. P 1 will have 50% of total processor time, P 2 will have 15%, and P 3 will have 20%. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 50 / 58

75 Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 51 / 58

76 POSIX Real-Time Scheduling API provides functions for managing real-time threads/processes: Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 52 / 58

77 POSIX Real-Time Scheduling API provides functions for managing real-time threads/processes: Defines two scheduling classes for real-time threads: 1 SCHED FIFO: scheduled using a FCFS strategy with a FIFO queue. There is no time-slicing for threads/processes of equal priority. 2 SCHED RR: similar to SCHED FIFO except time-slicing occurs for threads/processes of equal priority. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 52 / 58

78 Setting the Linux Scheduling Policy sched getscheduler() and sched setscheduler() manipulate the scheduling policy. #include <sched.h> struct sched_param { /*... */ int sched_priority; /*... */ }; int sched_getscheduler(pid_t pid); int sched_setscheduler(pid_t pid, int policy, const struct sched_param *sp); Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 53 / 58

79 Get Priority int policy; /* get our scheduling policy */ policy = sched_getscheduler(0); switch(policy) { case SCHED_OTHER: printf("policy is normal\n"); break; case SCHED_RR: printf("policy is round-robin\n"); break; case SCHED_FIFO: printf("policy is first-in, first-out\n"); break; case -1: perror("sched_getscheduler"); break; default: fprintf(stderr, "Unknown policy!\n"); } Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 54 / 58

80 Set Priority struct sched_param sp = {.sched_priority = 1 }; int ret; ret = sched_setscheduler(0, SCHED_RR, &sp); if (ret == -1) { perror("sched_setscheduler"); return 1; } Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 55 / 58

81 Summary Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 56 / 58

82 Summary Thread scheduling: PCS and SCS Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 57 / 58

83 Summary Thread scheduling: PCS and SCS Multi-processor scheduling: SMP, processor affinity, load balancing Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 57 / 58

84 Summary Thread scheduling: PCS and SCS Multi-processor scheduling: SMP, processor affinity, load balancing Real-time scheduling: soft and hard real times Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 57 / 58

85 Summary Thread scheduling: PCS and SCS Multi-processor scheduling: SMP, processor affinity, load balancing Real-time scheduling: soft and hard real times Real-time scheduling algorithms Priority-based Rate-monotonic Earliest-deadline-first Proportional share scheduling Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 57 / 58

86 Questions? Acknowledgements Some slides were derived from Avi Silberschatz slides. Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 58 / 58

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

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 Objectives To introduce CPU scheduling, which is the basis for multiprogrammed operating systems To describe various CPU-scheduling algorithms

More information

Chapter 6: CPU Scheduling

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

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

Chapter 6: CPU Scheduling

Chapter 6: CPU Scheduling 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

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

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

Chapter 5: Process Scheduling

Chapter 5: Process Scheduling Chapter 5: Process Scheduling Chapter 5: Process Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Real-Time CPU Scheduling Operating Systems

More information

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

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

Chapter 5: Process Scheduling

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

Chapter 5 Process Scheduling

Chapter 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 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 5: CPU Scheduling. Operating System Concepts 9 th Edit9on

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

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

CPU Scheduling. Operating Systems (Fall/Winter 2018) Yajin Zhou (  Zhejiang University Operating Systems (Fall/Winter 2018) CPU Scheduling Yajin Zhou (http://yajin.org) Zhejiang University Acknowledgement: some pages are based on the slides from Zhi Wang(fsu). Review Motivation to use threads

More information

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

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

Chapter 5: CPU Scheduling

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

More information

Chapter 6: CPU Scheduling

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

Chapter 5 CPU scheduling

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

CS307: Operating Systems

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

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

Round Robin (RR) ACSC 271 Operating Systems. RR Example. RR Scheduling. Lecture 9: Scheduling Algorithms Round Robin (RR) ACSC 271 Operating Systems Lecture 9: Scheduling Algorithms Each process gets a small unit of CPU time (time quantum), usually 10-100 milliseconds. After this time has elapsed, the process

More information

Scheduling. Today. Next Time Process interaction & communication

Scheduling. Today. Next Time Process interaction & communication Scheduling Today Introduction to scheduling Classical algorithms Thread scheduling Evaluating scheduling OS example Next Time Process interaction & communication Scheduling Problem Several ready processes

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

Operating Systems CS 323 Ms. Ines Abbes

Operating Systems CS 323 Ms. Ines Abbes Taibah University College of Community of Badr Computer Science Department Operating Systems CS71/CS72 جامعة طيبة كلية المجتمع ببدر قسم علوم الحاسب مقرر: نظم التشغيل Operating Systems CS 323 Ms. Ines Abbes

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

Job Scheduling. CS170 Fall 2018

Job Scheduling. CS170 Fall 2018 Job Scheduling CS170 Fall 2018 What to Learn? Algorithms of job scheduling, which maximizes CPU utilization obtained with multiprogramming Select from ready processes and allocates the CPU to one of them

More information

CPU Scheduling: Objectives

CPU Scheduling: Objectives CPU Scheduling: Objectives CPU scheduling, the basis for multiprogrammed operating systems CPU-scheduling algorithms Evaluation criteria for selecting a CPU-scheduling algorithm for a particular system

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

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

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2019 Lecture 8 Scheduling Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ POSIX: Portable Operating

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

Chapter 19: Real-Time Systems. Operating System Concepts 8 th Edition,

Chapter 19: Real-Time Systems. Operating System Concepts 8 th Edition, Chapter 19: Real-Time Systems, Silberschatz, Galvin and Gagne 2009 Chapter 19: Real-Time Systems System Characteristics Features of Real-Time Systems Implementing Real-Time Operating Systems Real-Time

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

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

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

Process Concept Process in Memory Process State new running waiting ready terminated Diagram of Process State

Process Concept Process in Memory Process State new running waiting ready terminated Diagram of Process State Process Concept An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks Textbook uses the terms job and process almost interchangeably Process a

More information

LECTURE 3:CPU SCHEDULING

LECTURE 3:CPU SCHEDULING LECTURE 3:CPU SCHEDULING 1 Outline Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time CPU Scheduling Operating Systems Examples Algorithm Evaluation 2 Objectives

More information

CS370 Operating Systems

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

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

Scheduling. Today. Next Time. ! Introduction to scheduling! Classical algorithms. ! Process interaction & communication

Scheduling. Today. Next Time. ! Introduction to scheduling! Classical algorithms. ! Process interaction & communication Scheduling Today! Introduction to scheduling! Classical algorithms Next Time! Process interaction & communication Scheduling! Problem Several ready processes and threads & much fewer CPUs! A choice has

More information

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

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective Part I: Operating system overview: Processes and threads 1 Overview Process concept Process scheduling Thread

More information

Practice Exercises 305

Practice Exercises 305 Practice Exercises 305 The FCFS algorithm is nonpreemptive; the RR algorithm is preemptive. The SJF and priority algorithms may be either preemptive or nonpreemptive. Multilevel queue algorithms allow

More information

Multithreaded Programming

Multithreaded Programming Multithreaded Programming The slides do not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. September 4, 2014 Topics Overview

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

York University Lassonde School of Engineering Department of Electrical Engineering and Computer Science

York University Lassonde School of Engineering Department of Electrical Engineering and Computer Science York University Lassonde School of Engineering Department of Electrical Engineering and Computer Science Midterm EECS 3221.03Z Operating Systems Fundamentals Feb 26, 2015 (14:30-16:00) Section: EECS3221Z

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

Threads. What is a thread? Motivation. Single and Multithreaded Processes. Benefits

Threads. What is a thread? Motivation. Single and Multithreaded Processes. Benefits CS307 What is a thread? Threads A thread is a basic unit of CPU utilization contains a thread ID, a program counter, a register set, and a stack shares with other threads belonging to the same process

More information

Implementing Task Schedulers (1) Real-Time and Embedded Systems (M) Lecture 10

Implementing Task Schedulers (1) Real-Time and Embedded Systems (M) Lecture 10 Implementing Task Schedulers (1) Real-Time and Embedded Systems (M) Lecture 10 Lecture Outline Implementing priority scheduling: Tasks, threads and queues Building a priority scheduler Fixed priority scheduling

More information

Scheduling. CSC400 - Operating Systems. 7: Scheduling. J. Sumey. one of the main tasks of an OS. the scheduler / dispatcher

Scheduling. CSC400 - Operating Systems. 7: Scheduling. J. Sumey. one of the main tasks of an OS. the scheduler / dispatcher CSC400 - Operating Systems 7: Scheduling J. Sumey Scheduling one of the main tasks of an OS the scheduler / dispatcher concerned with deciding which runnable process/thread should get the CPU next occurs

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

Uniprocessor Scheduling. Basic Concepts Scheduling Criteria Scheduling Algorithms. Three level scheduling

Uniprocessor Scheduling. Basic Concepts Scheduling Criteria Scheduling Algorithms. Three level scheduling Uniprocessor Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Three level scheduling 2 1 Types of Scheduling 3 Long- and Medium-Term Schedulers Long-term scheduler Determines which programs

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

CS370 Operating Systems Midterm Review

CS370 Operating Systems Midterm Review CS370 Operating Systems Midterm Review Yashwant K Malaiya Fall 2015 Slides based on Text by Silberschatz, Galvin, Gagne 1 1 What is an Operating System? An OS is a program that acts an intermediary between

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

Chap 7, 8: Scheduling. Dongkun Shin, SKKU

Chap 7, 8: Scheduling. Dongkun Shin, SKKU Chap 7, 8: Scheduling 1 Introduction Multiprogramming Multiple processes in the system with one or more processors Increases processor utilization by organizing processes so that the processor always has

More information

Priority-driven Scheduling of Periodic Tasks (2) Advanced Operating Systems (M) Lecture 5

Priority-driven Scheduling of Periodic Tasks (2) Advanced Operating Systems (M) Lecture 5 Priority-driven Scheduling of Periodic Tasks (2) Advanced Operating Systems (M) Lecture 5 Lecture Outline Schedulability tests for fixed-priority systems Conditions for optimality and schedulability General

More information

Announcements. Program #1. Program #0. Reading. Is due at 9:00 AM on Thursday. Re-grade requests are due by Monday at 11:59:59 PM.

Announcements. Program #1. Program #0. Reading. Is due at 9:00 AM on Thursday. Re-grade requests are due by Monday at 11:59:59 PM. Program #1 Announcements Is due at 9:00 AM on Thursday Program #0 Re-grade requests are due by Monday at 11:59:59 PM Reading Chapter 6 1 CPU Scheduling Manage CPU to achieve several objectives: maximize

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 3305 Intro to Threads. Lecture 6

CS 3305 Intro to Threads. Lecture 6 CS 3305 Intro to Threads Lecture 6 Introduction Multiple applications run concurrently! This means that there are multiple processes running on a computer Introduction Applications often need to perform

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

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

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

Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts. Scheduling Criteria Scheduling Algorithms Operating System Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts Scheduling Criteria Scheduling Algorithms OS Process Review Multicore Programming Multithreading Models Thread Libraries Implicit

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

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

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

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

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

Operating system concepts. Task scheduling

Operating system concepts. Task scheduling Operating system concepts Task scheduling Task scheduling (thread scheduling) Target of scheduling are ready tasks ACTIVE TASK BLOCKED TASKS PASSIVE TASKS READY TASKS Active task currently running on processor

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

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

Definition Multithreading Models Threading Issues Pthreads (Unix)

Definition Multithreading Models Threading Issues Pthreads (Unix) Chapter 4: Threads Definition Multithreading Models Threading Issues Pthreads (Unix) Solaris 2 Threads Windows 2000 Threads Linux Threads Java Threads 1 Thread A Unix process (heavy-weight process HWP)

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

by Maria Lima Term Paper for Professor Barrymore Warren Mercy College Division of Mathematics and Computer Information Science

by Maria Lima Term Paper for Professor Barrymore Warren Mercy College Division of Mathematics and Computer Information Science by Maria Lima Term Paper for Professor Barrymore Warren Mercy College Division of Mathematics and Computer Information Science Table of Contents 1. Introduction...1 2. CPU Scheduling Overview...1 3. Processes

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

Course Syllabus. Operating Systems

Course Syllabus. Operating Systems Course Syllabus. Introduction - History; Views; Concepts; Structure 2. Process Management - Processes; State + Resources; Threads; Unix implementation of Processes 3. Scheduling Paradigms; Unix; Modeling

More information

8: Scheduling. Scheduling. Mark Handley

8: Scheduling. Scheduling. Mark Handley 8: Scheduling Mark Handley Scheduling On a multiprocessing system, more than one process may be available to run. The task of deciding which process to run next is called scheduling, and is performed by

More information

Last Class: Processes

Last Class: Processes Last Class: Processes A process is the unit of execution. Processes are represented as Process Control Blocks in the OS PCBs contain process state, scheduling and memory management information, etc A process

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2019 Lecture 7 Threads Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Amdahls law example: Person

More information

Subject Name: OPERATING SYSTEMS. Subject Code: 10EC65. Prepared By: Kala H S and Remya R. Department: ECE. Date:

Subject Name: OPERATING SYSTEMS. Subject Code: 10EC65. Prepared By: Kala H S and Remya R. Department: ECE. Date: Subject Name: OPERATING SYSTEMS Subject Code: 10EC65 Prepared By: Kala H S and Remya R Department: ECE Date: Unit 7 SCHEDULING TOPICS TO BE COVERED Preliminaries Non-preemptive scheduling policies Preemptive

More information

Beyond Ada 2005: Allocating Tasks to Processors in SMP Systems

Beyond Ada 2005: Allocating Tasks to Processors in SMP Systems Beyond Ada 2005: Allocating Tasks to Processors in SMP Systems A.J. Wellings and A. Burns Department of Computer Science University of York, UK {andy,burns}@cs.york.ac.uk Abstract Ada 2005 has added no

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

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

ALL the assignments (A1, A2, A3) and Projects (P0, P1, P2) we have done so far. Midterm Exam Reviews ALL the assignments (A1, A2, A3) and Projects (P0, P1, P2) we have done so far. Particular attentions on the following: System call, system kernel Thread/process, thread vs process

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) 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? 1 / 31 CPU Scheduling new admitted interrupt exit terminated

More information

20-EECE-4029 Operating Systems Spring, 2015 John Franco

20-EECE-4029 Operating Systems Spring, 2015 John Franco 20-EECE-4029 Operating Systems Spring, 2015 John Franco First Exam name: Question 1: Semaphores The code below produces a line consisting of 10 each of the letters A, B, and C. What other relationship

More information

Scheduling. Scheduling 1/51

Scheduling. 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 information

Lecture Contents. 1. Overview. 2. Multithreading Models 3. Examples of Thread Libraries 4. Summary

Lecture Contents. 1. Overview. 2. Multithreading Models 3. Examples of Thread Libraries 4. Summary Lecture 4 Threads 1 Lecture Contents 1. Overview 2. Multithreading Models 3. Examples of Thread Libraries 4. Summary 2 1. Overview Process is the unit of resource allocation and unit of protection. Thread

More information

Supplementary Materials on Multilevel Feedback Queue

Supplementary Materials on Multilevel Feedback Queue Supplementary Materials on Multilevel Feedback Queue Review Each job runs for the same amount of time. All jobs arrive at the same time. Once started, each job runs to completion. Performance is more important.

More information

Multicore and Multiprocessor Systems: Part I

Multicore and Multiprocessor Systems: Part I Chapter 3 Multicore and Multiprocessor Systems: Part I Max Planck Institute Magdeburg Jens Saak, Scientific Computing II 44/337 Symmetric Multiprocessing Definition (Symmetric Multiprocessing (SMP)) The

More information

Scheduling. Scheduling 1/51

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

Frequently asked questions from the previous class survey

Frequently asked questions from the previous class survey CS 370: OPERATING SYSTEMS [CPU SCHEDULING] Shrideep Pallickara Computer Science Colorado State University L15.1 Frequently asked questions from the previous class survey Could we record burst times in

More information

CS510 Operating System Foundations. Jonathan Walpole

CS510 Operating System Foundations. Jonathan Walpole CS510 Operating System Foundations Jonathan Walpole The Process Concept 2 The Process Concept Process a program in execution Program - description of how to perform an activity instructions and static

More information

Comp 310 Computer Systems and Organization

Comp 310 Computer Systems and Organization Comp 310 Computer Systems and Organization Lecture #9 Process Management (CPU Scheduling) 1 Prof. Joseph Vybihal Announcements Oct 16 Midterm exam (in class) In class review Oct 14 (½ class review) Ass#2

More information

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst Operating Systems CMPSCI 377 Spring 2017 Mark Corner University of Massachusetts Amherst Multilevel Feedback Queues (MLFQ) Multilevel feedback queues use past behavior to predict the future and assign

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

Introduction to Operating Systems (Part II)

Introduction to Operating Systems (Part II) Introduction to Operating Systems (Part II) Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/24 1 / 45 Computer

More information

Announcements. Program #1. Reading. Due 2/15 at 5:00 pm. Finish scheduling Process Synchronization: Chapter 6 (8 th Ed) or Chapter 7 (6 th Ed)

Announcements. Program #1. Reading. Due 2/15 at 5:00 pm. Finish scheduling Process Synchronization: Chapter 6 (8 th Ed) or Chapter 7 (6 th Ed) Announcements Program #1 Due 2/15 at 5:00 pm Reading Finish scheduling Process Synchronization: Chapter 6 (8 th Ed) or Chapter 7 (6 th Ed) 1 Scheduling criteria Per processor, or system oriented CPU utilization

More information

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

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University Frequently asked questions from the previous class survey CS 370: SYSTEM ARCHITECTURE & SOFTWARE [CPU SCHEDULING] Shrideep Pallickara Computer Science Colorado State University OpenMP compiler directives

More information

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

CPU Scheduling. Schedulers. CPSC 313: Intro to Computer Systems. Intro to Scheduling. Schedulers in the OS Schedulers in the OS Scheduling Structure of a Scheduler Scheduling = Selection + Dispatching Criteria for scheduling Scheduling Algorithms FIFO/FCFS SPF / SRTF Priority - Based Schedulers start long-term

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