Chapter 5: CPU Scheduling
Operating System Concepts 8th Edition
Operating System Concepts 8th Edition
5.1
Silberschatz, Galvin and Gagne 2009
Chapter 5: CPU Scheduling
s
Basic Concepts
s
Scheduling Criteria
s
Scheduling Algorithms
s
Thread Scheduling
s
Mu
Chapter 3: Processes
Operating System Concepts 8th Edition
Operating System Concepts 8th Edition
3.1
Silberschatz, Galvin and Gagne 2009
Chapter 3: Processes
s
Process Concept
s
Process Scheduling
s
Operations on Processes
s
Interprocess Communication
s
E
Chapter 4: Threads
Operating System Concepts 8th8th Edition
Operating System Concepts Edition
4.1
Silberschatz, Galvin and Gagne 2009
Silberschatz, Galvin and Gagne 2009
Chapter 4: Threads
s
Overview
s
Multithreading Models
s
Thread Libraries
s
Threading
Chapter 6: Process Synchronization
Operating System Concepts 8th Edition
Operating System Concepts 8th Edition
6.1
Silberschatz, Galvin and Gagne 2009
Module 6: Process Synchronization
s
s
s
s
s
s
s
s
s
Background
The Critical-Section Problem
Petersons So
Chapter 7: Deadlocks
Operating System Concepts 8th Edition
Operating System Concepts 8th Edition
7.1
Silberschatz, Galvin and Gagne 2009
Chapter 7: Deadlocks
s
The Deadlock Problem
s
System Model
s
Deadlock Characterization
s
Methods for Handling Deadlock
19
Paging: Faster Translations (TLBs)
Using paging as the core mechanism to support virtual memory can lead
to high performance overheads. By chopping the address space into small,
xed-sized units (i.e., pages), paging requires a large amount of mapping
i
20
Paging: Smaller Tables
We now tackle the second problem that paging introduces: page tables
are too big and thus consume too much memory. Lets start out with
a linear page table. As you might recall1 , linear page tables get pretty
big. Assume again a
16
Segmentation
So far we have been putting the entire address space of each process in
memory. With the base and bounds registers, the OS can easily relocate
processes to different parts of physical memory. However, you might
have noticed something inter
15
Mechanism: Address Translation
In developing the virtualization of the CPU, we focused on a general
mechanism known as limited direct execution (or LDE). The idea behind LDE is simple: for the most part, let the program run directly on the
hardware; ho
17
Free-Space Management
In this chapter, we take a small detour from our discussion of virtualizing memory to discuss a fundamental aspect of any memory management system, whether it be a malloc library (managing pages of a processs heap) or the OS itsel
22
Beyond Physical Memory: Policies
In a virtual memory manager, life is easy when you have a lot of free
memory. A page fault occurs, you nd a free page on the free-page list,
and assign it to the faulting page. Hey, Operating System, congratulations! Yo
21
Beyond Physical Memory: Mechanisms
Thus far, weve assumed that an address space is unrealistically small
and ts into physical memory. In fact, weve been assuming that every
address space of every running process ts into memory. We will now
relax these
24
Summary Dialogue on Memory Virtualization
Student: (Gulps) Wow, that was a lot of material.
Professor: Yes, and?
Student: Well, how am I supposed to remember it all? You know, for the exam?
Professor: Goodness, I hope thats not why you are trying to re
9
Scheduling: Proportional Share
In this chapter, well examine a different type of scheduler known as a
proportional-share scheduler, also sometimes referred to as a fair-share
scheduler. Proportional-share is based around a simple concept: instead
of opt
7
Scheduling: Introduction
By now low-level mechanisms of running processes (e.g., context switching) should be clear; if they are not, go back a chapter or two, and read the
description of how that stuff works again. However, we have yet to understand th
8
Scheduling:
The Multi-Level Feedback Queue
In this chapter, well tackle the problem of developing one of the most
well-known approaches to scheduling, known as the Multi-level Feedback Queue (MLFQ). The Multi-level Feedback Queue (MLFQ) scheduler was rs
5
Interlude: Process API
A SIDE : I NTERLUDES
Interludes will cover more practical aspects of systems, including a particular focus on operating system APIs and how to use them. If you dont
like practical things, you could skip these interludes. But you s
12
A Dialogue on Memory Virtualization
Student: So, are we done with virtualization?
Professor: No!
Student: Hey, no reason to get so excited; I was just asking a question. Students
are supposed to do that, right?
Professor: Well, professors do always say
Exact Algorithms for
NP-Complete Problems
The Traveling
Algorithms: Design Salesman Problem
and Analysis, Part II
The Traveling Salesman Problem
Input: A complete undirected graph with nonnegative edge costs.
Output: A minimum-cost tour (i.e., a cycle tha
Exact Algorithms for
NP-Complete Problems
A Dynamic Programming
Algorithms: Design Algorithm for TSP
and Analysis, Part II
The Subproblems
Moral of last video: To enforce constraint that each vertex visited
exactly once, need to remember the identities of
Exact Algorithms for
NP-Complete Problems
Smarter Search for
Algorithms: Design Vertex Cover
and Analysis, Part II
The Vertex Cover Problem
Given: An undirected graph G = (V , E ).
Goal: Compute a minimum-cardinality vertex cover (a set S V
that includes
Exact Algorithms for
NP-Complete Problems
The Vertex Cover
Algorithms: Design Problem
and Analysis, Part II
The Vertex Cover Problem
Input: An undirected graph G = (V , E ).
Goal: Compute a minimum-cardinality vertex cover a subset
S V that contains at le
Minimum
Spanning Trees
Proof of the Cut
Algorithms: Design
and Analysis, Part II Property
The Cut Property
Assumption: Distinct edge costs.
CUT PROPERTY: Consider an edge e of G . Suppose there is a
cut (A, B) such that e is the cheapest edge of G that cr
Minimum
Spanning Trees
Fast Implementation
Algorithms: Design
and Analysis, Part II of Prims Algorithm
Running Time of Prims Algorithm
- Initialize X = cfw_s [s V chosen arbitrarily]
- T = [invariant: X = vertices spanned by tree-so-far T ]
- While X = V
Minimum
Spanning Trees
Correctness of Prims
Algorithms: Design
and Analysis, Part II Algorithm (Part II)
Correctness of Prims Algorithm
Theorem: Prims algorithm always outputs a minimum-cost
spanning tree.
Key Question: When is it safe to include an edge
Minimum
Spanning Trees
Correctness of Prims
Algorithms: Design
and Analysis, Part II Algorithm (Part I)
Cuts
Claim: Prims algorithm outputs a spanning tree.
Denition: A cut of a graph G = (V , E ) is a partition of V into 2
non-empty sets.
A
B
Edges that
Minimum
Spanning Trees
Algorithms: Design
and Analysis, Part II
Prims MST Algorithm
Example
[Purple edges = minimum spanning tree]
(Compare to Dijkstras shortest-path algorithm)
1
3
2
4
5
Tim Roughgarden
Prims MST Algorithm
- Initialize X = cfw_s [s V cho
Minimum
Spanning Trees
Algorithms: Design
and Analysis, Part II
Problem Denition
Overview
Informal Goal: Connect a bunch of points together as cheaply as
possible.
Applications: Clustering (more later), networking.
Blazingly Fast Greedy Algorithms:
- Prim
Greedy Algorithms
A Scheduling Application:
Correctness Proof Part II
Algorithms: Design
and Analysis, Part II
Cost-Benet Analysis, Part I
i >j
more
stu
j
i
stu
more
stu
i
j
stu
exchange i, j
new schedule
Question: What is the eect of this exchange on th
Greedy Algorithms
A Scheduling Application:
Handling Ties
Algorithms: Design
and Analysis, Part II
Correctness Claim
Claim: Algorithm #2 (order jobs in nonincreasing order of ratio
wj /lj ) is always correct. [Even with ties]
New Proof Plan: Fix arbitrary