This is not the current version of the class.

Lecture 17

(Notes by Thomas Lively)

Front matter

AddressSanitizer is pushed! Hook up your allocators.

There is a chickadee file system! Read the docs.

There will be one more pset. It will be threads.

If you're up to date you'll be able to do a project as well!

Scheduling

Goal: Divide resources fairly among jobs

Is round robin fair? No because blocking processes lose part of their time slices and are forever disadvantaged.

Priority

Strict priority: job with highest priority always runs.

Weighted fair sharing

Can use lottery scheduling

N jobs, weights w1...wn

T = sum(w)
pick a random R in [0, T)
for i in [1, n]:
    if R < wi:
        return i
    else:
        R -= wi

This algo is O(n). Use an array of length T full of pids to make it O(1).

Can use stride scheduling

Each process gets stride si = 1/wi, ticket Ti

  1. Pick the process with minimum Ti
  2. Run it
  3. Ti = Ti + Si

Use circular arithmetic to make overflow a non-issue

Weighted fair sharing does not handle low latency jobs

Examples:

When deadlines are missed there are Problems(TM)

BVT scheduling

BVT: “Borrowed-Virtual-Time (BVT) scheduling: Supporting latency-sensitive threads in a general-purpose scheduler.” Kenneth J. Duda and David R. Cheriton. In Proc. SOSP 1999. Link

Systems need to run a larger and more diverse set of applications, from real-time to interactive to batch, on uniprocessor and multiprocessor platforms. However, most schedulers either do not address latency requirements or are specialized to complex real-time paradigms, limiting their applicability to general-purpose systems.

In this paper, we present Borrowed-Virtual-Time (BVT) Scheduling, showing that it provides low-latency for realtime and interactive applications yet weighted sharing of the CPU across applications according to system policy, even with thread failure at the real-time level, all with a low-overhead implementation on multiprocessors as well as uniprocessors. It makes minimal demands on application developers, and can be used with a reservation or admission control module for hard real-time applications.

[The BVT scheduling paper!] Stride (WFS) + low latency support

Effective ticket for process i:

Ei = Ti - (warp ? Wi : 0)

When a blocked process unblocks:

Ti = max(Ti, min(runnable Tis))

By subtracting a little bit from Ti, we reward sleeping

warp is 0 for throughput jobs, >0 for latency jobs