Ralf Juengling Portland State University The Structuring of Systems using Upcalls David D. Clark, “The Structuring of Systems using Upcalls”, Proc. of.

Slides:



Advertisements
Similar presentations
Categories of I/O Devices
Advertisements

More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Chorus and other Microkernels Presented by: Jonathan Tanner and Brian Doyle Articles By: Jon Udell Peter D. Varhol Dick Pountain.
EEE 435 Principles of Operating Systems Principles and Structure of I/O Software (Modern Operating Systems 5.2 & 5.3) 5/22/20151Dr Alain Beaulieu.
Chapter 7 Protocol Software On A Conventional Processor.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
CS533 Concepts of Operating Systems Class 5 System Structuring using Layers & Micro-Kernel Based OSs.
The Structuring of Systems Using Upcalls David D Clark Presented by: Prassnitha Sampath.
Precept 3 COS 461. Concurrency is Useful Multi Processor/Core Multiple Inputs Don’t wait on slow devices.
1 Concurrent and Distributed Systems Introduction 8 lectures on concurrency control in centralised systems - interaction of components in main memory -
CS533 Concepts of Operating Systems Class 7 System Structuring using Layers and Micro-kernels.
CS533 Concepts of Operating Systems Class 11 System Structuring using Layers.
G Robert Grimm New York University Extensibility: SPIN and exokernels.
CS533 Concepts of Operating Systems Class 8 System Structuring using Layers.
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
Communication in Distributed Systems –Part 2
CPS110: Implementing threads/locks on a uni-processor Landon Cox.
The Structuring of Systems Using Upcalls David D. Clark 4/26/20111Frank Sliz, CS533, Upcalls.
The Structuring of Systems Using Upcalls David D. Clark Presenter: Haitham Gad.
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
The Structuring of Systems Using Upcalls Paper by David D. Clark Presentation by Emerson Murphy-Hill.
1 Lightweight Remote Procedure Call Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska and Henry M. Levy Presented by: Karthika Kothapally.
CS510 Concurrent Systems Jonathan Walpole. Lightweight Remote Procedure Call (LRPC)
Networked File System CS Introduction to Operating Systems.
LWIP TCP/IP Stack 김백규.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS6: Device Management 6.1. Principles of I/O.
LWIP TCP/IP Stack 김백규.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
CS533 Concepts of Operating Systems Jonathan Walpole.
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved RPC Tanenbaum.
3.14 Work List IOC Core Channel Access. Changes to IOC Core Online add/delete of record instances Tool to support online add/delete OS independent layer.
Processes Introduction to Operating Systems: Module 3.
Middleware Services. Functions of Middleware Encapsulation Protection Concurrent processing Communication Scheduling.
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
The Mach System Silberschatz et al Presented By Anjana Venkat.
CS533 – Spring Jeanie M. Schwenk Experiences and Processes and Monitors with Mesa What is Mesa? “Mesa is a strongly typed, block structured programming.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
COT 4600 Operating Systems Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 3:00-4:00 PM.
Managing Processors Jeff Chase Duke University. The story so far: protected CPU mode user mode kernel mode kernel “top half” kernel “bottom half” (interrupt.
1 Why Threads are a Bad Idea (for most purposes) based on a presentation by John Ousterhout Sun Microsystems Laboratories Threads!
Presented by: JungChun Lu. Goal Propose a design methodology suitable for operating system programs which: Permits synchronous procedure call between.
I/O Software CS 537 – Introduction to Operating Systems.
Where Testing Fails …. Problem Areas Stack Overflow Race Conditions Deadlock Timing Reentrancy.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Lecture 5 Page 1 CS 111 Summer 2013 Bounded Buffers A higher level abstraction than shared domains or simple messages But not quite as high level as RPC.
The Structuring of Systems Using Upcalls By David D. Clark Presented by Samuel Moffatt.
The Structuring of Systems Using Upcalls David D. Clark (Presented by John McCall)
Introduction to Operating Systems Concepts
REAL-TIME OPERATING SYSTEMS
LWIP TCP/IP Stack 김백규.
CS 6560: Operating Systems Design
Topics Covered What is Real Time Operating System (RTOS)
Presentation by Omar Abu-Azzah
The Structuring of Systems Using Upcalls David D. Clark
CS 501: Software Engineering Fall 1999
Lecture Topics: 11/1 General Operating System Concepts Processes
CSE 451: Operating Systems Spring 2007 Module 15 I/O
Structuring Of Systems Using Upcalls - By David D. Clark
Top Half / Bottom Half Processing
CS533 Concepts of Operating Systems Class 11
Why Threads Are A Bad Idea (for most purposes)
Structuring of Systems using Upcalls
Outline Operating System Organization Operating System Examples
Why Threads Are A Bad Idea (for most purposes)
Why Threads Are A Bad Idea (for most purposes)
Threads CSE 2431: Introduction to Operating Systems
Presentation transcript:

Ralf Juengling Portland State University The Structuring of Systems using Upcalls David D. Clark, “The Structuring of Systems using Upcalls”, Proc. of the 10 th Symposium on Operating System Principles, pp , 1985.

Layers When you bake a big cake or write a big program, you will probably do it in layers

Layers as one way of abstracting When writing big code you need abstractions to be able to… Think about your code Communicate your code to others Test your code Adapt your code later to changed requirements For many applications layered abstractions are natural Protocol stacks Compilers Database management Scientific computing applications Operating systems

Flow of control in layered code Clients XYZ Library (stateless) May have any number of concurrent threads if code is reentrant

Additional requirements in OS kernel code Handle device interrupts timely Support dynamic updating of modules (e.g., device drivers) but don’t compromise safety Solutions: Have interrupt handlers communicate with devices and let other code communicate with interrupt handlers asynchronously (buffers, messages) Contain modules in own address spaces Use IPC to let different modules communicate across protection boundaries

In kernel code… …we have: 1.Abstraction boundaries 2.Protection boundaries 3.Downward control flow 4.Upward control flow … communication between layers is more costly because: Control flow across protection boundaries (RPC, messages,…) Upward control flow across abstraction boundaries (buffers)

Flow of control in kernel code Note: Layers have state Need to synchronize shared data Call across layers crosses protection boundary Upward data flow is asynchronous (buffers) For some layers there is a dedicated task (pipeline) Downward control flow may be asynchronous or synchronous

In kernel code… … communication between layers is more costly because: Control flow across protection boundaries Upward control flow across abstraction boundaries Clark’s solution: Let upward flow control proceed synchronously with upcalls Get rid of protection boundaries

Upcalls Idea: Leave “blanks” in lower-level code Let higher level code “fill in the blanks” in form of handlers In functional programming this technique is used every day, in OO programming every other day. Other terms: Handler function, Callback function, Virtual method Does using upcalls abolish abstraction boundaries?

Flow of control in kernel code It looks a bit more like layered library code Procedure calls instead of IPC Plus Upcalls But we can’t do completely without buffering

Protocol package example net-open net-receive net-dispatch transport-open transport-receive transport-get-port display-start display-receive transport-receive is a handler for net-receive display-receive is a handler for transport-receive a handler gets registered by an xxx-open call wakeup create-task

Protocol package example net-open net-receive net-dispatch transport-open transport-receive transport-get-port display-start display-receive display-start(): local-port = transport-open(display-receive) end transport-open(receive-handler): local-port = net-open(transport-receive) handler-array(local-port) = receive-handler return local-port end net-open(receive-handler): port = generate-uid() handler-array(port) = receive-handler task-array(port) = create-task(net-receive, port) return port end

Protocol package example net-open net-receive net-dispatch transport-open transport-receive transport-get-port display-start display-receive transport-get-port(packet): // determine whose packet this is extract port from packet return port end net-dispatch(): read packet from device restart device port = transport-get-port(packet) put packet on per port queue task-id = task-array(port) wakeup-task(task-id) end

Protocol package example net-open net-receive net-dispatch transport-open transport-receive transport-get-port display-start display-receive transport-get-port(packet): // determine whose packet this is extract port from packet return port end net-dispatch(): read packet from device restart device port = transport-get-port(packet) put packet on per port queue task-id = task-array(port) wakeup-task(task-id) end not quite clean

Protocol package example net-open net-receive net-dispatch transport-open transport-receive transport-get-port display-start display-receive display-receive(char): write char to display end transport-receive(packet, port): handler = handler-array(port) validate packet header for each char in packet: handler(char) end net-receive(port): handler = handle-array(port) do forever remove packet from per port queue handler(packet, port) block() end end

Full protocol package example

What if an upcall fails? This must not leave any shared data inconsistent! Two things need to be recovered: 1.The task 2.The per-client data in each layer/module Solution: Cleanly separate shared state from per-client data Have a per-layer cleanup procedure and arrange for the system to call it in case of a failure Unlock everything before an upcall

May upcalled code call down? This is a source of potential, subtle bugs: Indirect recursive call may change state unexpectedly Some solutions: 1.Check state after an upcall (ugly) 2.Don’t allow a handler to downcall (simple & easy) 3.Have upcalled procedure trigger future action instead of down-calling (example: transport-arm-for-send)

How to use locks? Don’t really know. With downcall-only there is a simple locking discipline: Have each layer use its own set of locks Have each subroutine release its lock before return No deadlock as a partial order is implied by the call graph Doesn’t work when upcalls are allowed. The principle behind their recipe “release any locks before an upcall” is asymmetry of trust: Trust the layers you depend on, but not your clients

Upcalls & Abstraction boundaries We get rid of protection boundaries for the sake of performance and to make upcalls practical We seemingly keep abstraction boundaries intact as we: Don’t leak information about the implementation by offering an upcall interface Don’t know our clients, they must register handlers But we need to observe some constraints to make it work: downcall policy locking discipline Cleanup interface

Other things in Swift Monitors for synchronization Task-scheduling with a “deadline priority” scheme Dynamic priority adjustment if a higher priority task waits for a lower priority task (“deadline promotion”) Inter-task communication per shared memory High-level implementation language (CLU, anyone?) Mark & Sweep garbage collector Oh, and “multi-task modules” are just layers with state prepared for multiple concurrent execution.

Time for coffee