190 likes | 326 Views
Towards a Schedu Capturing OS Expertise in an Event Type System: the Bossa Experience. Julia L. Lawall DIKU, University of Copenhagen Joint work with: Gilles Muller Obasco Group, Ecole des Mines de Nantes/INRIA http://www.emn.fr/x-info/bossa. Program issues.
E N D
Towards a ScheduCapturing OS Expertise in an Event Type System:the Bossa Experience Julia L. Lawall DIKU, University of Copenhagen Joint work with: Gilles Muller Obasco Group, Ecole des Mines de Nantes/INRIA http://www.emn.fr/x-info/bossa
Program issues • Approach: exploit the restricted nature of DSLs to address all of these issues. Does nothing wrong Does something right Executes efficiently
Context: OS extensibility • Goals: • Policies for specific applications. • Policies for specific execution contexts. • Eliminate unnecessary functionality for speed / reduced resource consumption. • Safety is critical
Approaches to OS extensibility • Berkeley Packet Filter: • interpreted for safety • Exo-kernel • extensions run at the user level • Proof-carrying code • extensions accompanied by a correctness proof • SPIN, OKE: • extensions written in a safe language • Address safety, correctness at best ad hoc.
DSLpolicy Bossa compiler/verifier Kernel (Linux) Compiled policy RTS A domain-specific approach Bossa, a DSL for developing CPU schedulers policy developers kernel expert
Bossa DSL: policy structure • Declarations • states • process attributes • process priorities • OS interface • Programmer interface
Extract of a scheduling policy states = { RUNNING running : process; READY ready : select sorted queue; READY expired : sorted queue; READY yield : process; BLOCKED blocked : queue; TERMINATED terminated; }
Event handlers handler (event e) { … On block.* { running => blocked; } On unblock.preemptive.* { if (!empty(running) && e.target > running) running => ready; e.target => ready; } … }
Correctness issues • Is the chosen algorithm appropriate? • Is the algorithm implemented faithfully? • Does the implementation interact correctly with the target OS? This work focuses on the third issue...
Event handlers handler (event e) { … On block.* { running => blocked; } On unblock.preemptive.* { if (!empty(running) && e.target > running) running => ready; e.target => ready; } … } Reasonable behavior, but what does the kernel expect?
Event types • For each event, describe: • Event notification context. • Expected handler effect. • block.*:[tgt in RUNNING] [tgt in BLOCKED] • Provided by the OS expert. • Goals: • Document kernel expectations. • Check that these expectations are satisfied. • Encapsulate kernel expertise. • Policy independent.
Event type examples • block.*: • [tgt in RUNNING] [tgt in BLOCKED] • unblock.preemptive.*: • [tgt in BLOCKED] [tgt in READY] • [p in RUNNING, tgt in BLOCKED] [[p, tgt] in READY] • Missing Linux expertise: • unblock.preemptive.* is an interrupt; affects block.*. • a process can be unblocked before it blocks.
Corrected types and handlers • block.*: • [tgt in RUNNING] [tgt in BLOCKED] • [[] = RUNNING, tgt in READY] [tgt in BLOCKED] On block.* { running => blocked; } should be: On block.* { e.target=> blocked; }
Corrected types and handlers • unblock.preemptive.*: • [tgt in BLOCKED] [tgt in READY] • [p in RUNNING, tgt in BLOCKED] [[p, tgt] in READY] • [tgt in RUNNING] [tgt in RUNNING] • [[] in RUNNING, tgt in READY] [tgt in READY] On unblock.preemptive.* { if (e.target in blocked) { if (!empty(running) && e.target > running) running => ready; e.target => ready; }}
Event types for safety • bossa.schedule • [[] = RUNNING, q in READY] [q in RUNNING] On bossa.schedule { if (empty(ready)) { if (empty(expired)) { yield => ready; } else { expired => ready; } } select() => running; }
Event types for optimization • block.*: • [tgt in RUNNING] [tgt in BLOCKED] • [[] = RUNNING, tgt in READY] [tgt in BLOCKED] • Specialized event sequences. if (tgt == running) move_proc_queue(running,blocked); else move_queue_queue(tgt,blocked);
Assessment • For critical OS services, need more than safety guarantees. • Analyzing the entire kernel with respect to each new policy is both expensive and not so necessary. • Event types guide the developer and permit relevant verifications.
Current status • Bossa versions of Linux 2.2 and 2.4 kernels. • Policies: • Process schedulers: • Linux, BSD, EDF, Progress-based, Linux O(1) • Virtual schedulers: • Fixed-priority, proportional share • Automatic kernel instrumentation in progress • Low overhead for lat_ctx. No overhead for more typical applications.
Future work • Test event type expressiveness: • New OSes: • BSD, OSes for real-time or embedded systems... • New policies • multimedia, real-time, energy aware… • Model checking for verifying policies. • Model checking for verifying event types. http://www.emn.fr/x-info/bossa