Scheduling Theory: Understanding Short-Term and Long-Term Scheduling, Study notes of Operating Systems

An in-depth exploration of scheduling theory, covering both short-term and long-term scheduling. Short-term scheduling determines which process gets to execute next, while long-term scheduling decides which jobs will become processes. Learn about different scheduling algorithms, their goals, and their trade-offs.

Typology: Study notes

2012/2013

Uploaded on 04/23/2013

ashalata
ashalata ๐Ÿ‡ฎ๐Ÿ‡ณ

3.8

(18)

106 documents

1 / 43

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Decide which processes are allowed to run when.
โ—‹
Optimize throughput, response time, etc.
โ—‹
Subject to constraints including context switch
time, swap time, etc.
โ—‹
The scheduling problem (Chapter 9)
Scheduling
Monday, November 22, 2004
11:22 AM
Scheduling Page 1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b

Partial preview of the text

Download Scheduling Theory: Understanding Short-Term and Long-Term Scheduling and more Study notes Operating Systems in PDF only on Docsity!

โ—‹ Decide which processes are allowed to run when. โ—‹ Optimize throughput, response time, etc. Subject to constraints including context switch time, swap time, etc.

The scheduling problem (Chapter 9) Scheduling Monday, November 22, 2004 11:22 AM Docsity.com

Input: some processes contending for resources. Output: a "schedule" of which process does what when. A "scheduler" is anything that produces a schedule. What's a schedule? What's a schedule? Tuesday, November 17, 2009 1:57 PM Docsity.com

A queueing model of scheduling: Short term: work is process "jiffies", completion is output from each jiffie. Long term: work is processes, completion is process output. Disk: work is blocks to post, completion is that the block appears on disk. Different kinds of scheduling A queueing model of scheduling Thursday, November 03, 2011 3:48 PM Docsity.com

In scheduling theory, a queue is any mechanism that takes in jobs and releases one at a time, according to some "queueing discipline". This is not a COMP15 queue First-in, First-out (FIFO) Prioritized - chosen according to univariate priority. Strategized - chosen according to multivariate rubrics. Randomized - chosen at random. Some queueing disciplines: This is not a COMP15 queue Thursday, November 03, 2011 4:07 PM Docsity.com

To understand scheduling, it's helpful to start with a physical metaphor. work =cpu cycles expended on a goal. Analogous to "distance traveled". throughput = work/ wallclock time = work per unit time. (= work cycles / second) efficiency = work / total cycles = % of time used wisely. processor speed = total cycles / wallclock time overhead = 1 - work / total cycles = % of time "wasted": used for purposes other than accomplishing computational goals. efficiency + overhead = 1 throughput = efficiency * processor speed Computational physics Computational physics Tuesday, November 17, 2009 1:37 PM Docsity.com

โ—‹ For N processes, how equally is work distributed? โ—‹ Only meaningful for processes at the same priority. โ—‹ 0 unfairness: everything is equal โ—‹ high unfairness: things are unequal Some authors define unfairness as the difference between maximum and minimum "work" runtimes allocated at the same priority level. โ—‹ Fairness Opposite of fairness is starvation : one or more processes don't get to run at all. Fairness Tuesday, November 17, 2009 1:48 PM Docsity.com

A queueing model of short-term scheduling Thursday, November 03, 2011 3:57 PM Docsity.com

A system clock that interrupts process execution at predetermined intervals and invokes the scheduler. Whenever a process blocks , control is returned to the scheduler even if its interval is not up. The scheduler only acts on processes in the run queue , i.e., processes ready to execute. Atomic operations are achieved by turning the scheduler off temporarily. Common to all short-term strategies Common to all short-term strategies Tuesday, November 17, 2009 3:37 PM Docsity.com

maximize efficiency => minimize scheduler overhead and context switches. reduce unfairness and latency => make context switches more frequent! The basic conflict in scheduling The fairest scheduler in the world has large overhead, while the most efficient one is very unfair, i.e., one process runs until it must sleep. The basic conflict Tuesday, November 17, 2009 2:14 PM Docsity.com

Satisfy particular goals.... Better, stronger, faster.... Scheduling is an active research topic "The O(1) scheduler" (<2009) "The Completely Fair Scheduler (>2009) Two linux schedulers of note: Scheduling is an active research topic Tuesday, November 06, 2012 11:55 AM Docsity.com

End repeat Bit array stores which lists in waiting[] are non-empty. O(1) to choose a non-empty list. O(1) to unlink an element from the head. O(1) to relink it elsewhere. O(1) to update bit arrays for empty/non-empty lists. Why is this O(1)? Docsity.com

static priority between - 19 (highest priority) and +20 (lowest priority). dynamic priority that is +- 5 of its static priority. Each linux process has a Static priority is set via the nice(1,2) command and system call. increased for I/O bound processes that are blocked waiting for I/O decreased for CPU-bound processes that compute without blocking. dynamic priority is Scheduling priority Scheduling priority Tuesday, November 06, 2012 12:21 PM Docsity.com

... because it's my ball... minimizes overhead lacks fairness O(1) scheduling ... because it's my ball... Tuesday, November 06, 2012 12:15 PM Docsity.com

The Completely Fair Scheduler (Linux >

Track total runtime allotted to a process. Store each priority of run queue as a priority queue where the priority is time spent so far. At each point, the process that has had the least runtime so far is scheduled. A process that hasn't run lately can "catch up" by consuming several contiguous slices. http://www.ibm.com/developerworks/linux/lib rary/l-completely-fair-scheduler/ Each runqueue is a red-black tree whose key is time spent running so far. Implementation: Schedule the leftmost process (least key) for a slice. Remove it from the tree. Update its time spent computing. Reinsert it into the tree. Repeat until runqueue's time allotment ends: For each runqueue, highest to lowest priority: For each epoch: The completely fair scheduler Tuesday, November 06, 2012 11:57 AM Docsity.com