The Structuring of Systems Using Upcalls David D. Clark (Presented by John McCall)

Slides:



Advertisements
Similar presentations
Chap 4 Multithreaded Programming. Thread A thread is a basic unit of CPU utilization It comprises a thread ID, a program counter, a register set and a.
Advertisements

Chapter 7 Protocol Software On A Conventional Processor.
ECE 526 – Network Processing Systems Design Software-based Protocol Processing Chapter 7: D. E. Comer.
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.
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.
Active Messages: a Mechanism for Integrated Communication and Computation von Eicken et. al. Brian Kazian CS258 Spring 2008.
Ralf Juengling Portland State University The Structuring of Systems using Upcalls David D. Clark, “The Structuring of Systems using Upcalls”, Proc. of.
The Structuring of Systems Using Upcalls David D. Clark 4/26/20111Frank Sliz, CS533, Upcalls.
User-Level Interprocess Communication for Shared Memory Multiprocessors Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy Presented.
The Structuring of Systems Using Upcalls David D. Clark Presenter: Haitham Gad.
The Structuring of Systems Using Upcalls Paper by David D. Clark Presentation by Emerson Murphy-Hill.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Threads.
CS533 Concepts of Operating Systems Jonathan Walpole.
Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.
VIRTUAL MEMORY By Thi Nguyen. Motivation  In early time, the main memory was not large enough to store and execute complex program as higher level languages.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
Object-Oriented Programming Chapter Chapter
Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy. Presented by: Tim Fleck.
Computer Science Lecture 3, page 1 CS677: Distributed OS Last Class: Communication in Distributed Systems Structured or unstructured? Addressing? Blocking/non-blocking?
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.
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.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
Remote Procedure Calls
OPERATING SYSTEM CONCEPT AND PRACTISE
Chapter 4: Threads.
Distributed Shared Memory
CS533 Concepts of Operating Systems
Chapter 4: Multithreaded Programming
Chapter 9 – Real Memory Organization and Management
The Structuring of Systems Using Upcalls David D. Clark
Chapter 4: Threads.
Chapter 4: Threads.
Chapter 4: Threads.
CSE 451: Operating Systems Winter 2006 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
OPERATING SYSTEMS Threads
Modified by H. Schulzrinne 02/15/10 Chapter 4: Threads.
CSE 451: Operating Systems Autumn 2003 Lecture 16 RPC
Chapter 4: Threads.
CSE 451: Operating Systems Winter 2007 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
By Brian N. Bershad, Thomas E. Anderson, Edward D
Fast Communication and User Level Parallelism
Chapter 4: Threads.
CSE 451: Operating Systems Winter 2004 Module 19 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Structuring Of Systems Using Upcalls - By David D. Clark
Operating Systems Lecture 3.
CSE 451: Operating Systems Spring 2012 Module 22 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CSE 451: Operating Systems Autumn 2009 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Presented by Neha Agrawal
Thomas E. Anderson, Brian N. Bershad,
Chapter 4: Threads.
CS533 Concepts of Operating Systems Class 11
Structuring of Systems using Upcalls
CS510 Operating System Foundations
Chapter 4: Threads.
January 15, 2004 Adrienne Noble
CSE 451: Operating Systems Autumn 2010 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Chapter 4: Threads.
CSE 451: Operating Systems Winter 2003 Lecture 16 RPC
CS703 – Advanced Operating Systems
Message Passing Systems Version 2
Last Class: Communication in Distributed Systems
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Chapter 4: Threads.
Message Passing Systems
Presentation transcript:

The Structuring of Systems Using Upcalls David D. Clark (Presented by John McCall)

A Quick Review of Layers Many designs are organized in terms of multiple layers of abstraction By convention, we talk about layers like they’re stacked on top of each other The most basic layer is on the bottom

Example (Libraries)

Example (Protocols)

Implementing the Design We can assign a module to each layer What happens if a module fails? –Optimally, the failure is detected –Dependent modules may be compromised –But everything else should be unaffected

Layers as Processes Natural solution: give each module its own process –Different address spaces, so no corruption –But now all inter-module communication is asynchronous –In practice, this is really inefficient Even in LRPC: the data is copied too often Even in URPC: there are too many asynchronous handoffs

Layers as Modules (1) So, put the modules in a single address space, as demonstrated in “Swift”, their research O.S. For safety, they wrote Swift in CLU: –Strong compile-time typing –Dynamic bounds checking –Garbage collection

Layers as Modules (2) Modules share the same space, so calls between them are just procedure calls Modules have to be multithreaded: –Assigning a single thread to each module and asynchronously handing off at boundaries is slow –So a single thread follows a job through the layers –So each layer has to handle multiple jobs at once Is there a discipline about who calls whom?

Downwards Control Flow Normally, we think of control flowing from the top down (downcalls) –The application calls a library –The library calls the system Just a normal procedure call: the lower level executes for a while, then returns to the upper level

Upwards Control Flow Sometimes, it’s more natural for control to flow upwards –One job sends a signal to another –The system gets a network packet Just like a normal procedure call: the upper level executes for a while, then returns to the lower level

Duality (1) Upcalls aren’t required: –The upper level can poll the lower level, asking if any interesting asynchronous events have occurred –But this is an asynchronous handoff from the low-level event to the polling job –And there’s inherent overhead in polling for multiple events at once

Duality (2) Downcalls aren’t required either! –A system with only upcalls would handle asynchronous events efficiently –But lower layers would have to poll to see if higher layers have any requests So, they’re dual notions –When should we use upcalls? –When should we use downcalls? –Are there inherent dangers with upcalls?

Downcall-based Sockets downcall: create and bind a socket downcall: receive data if possible downcall: send data if possible downcall: tell me when I can send or receive more data on any of these sockets

Upcall-based Sockets downcall: create and bind a socket –We also need to tell the socket layer which procedures to use as upcalls upcall: some data just arrived upcall: do you have any data to send? downcall: call me back if you can, I have data to send

Advantages of Upcalls (1) The lower level can ask the upper level for “advice” –Easier to implement useful optimizations like “piggybacking” –Gives us natural flow control for sockets No polling overhead/bottleneck –The higher level receives direct notification of changes

Advantages of Upcalls (2) Delays some thread design decisions –What thread do we make an upcall in? A single thread for each client? A pool of threads for each client? A pool of threads shared across clients? –Any of these decisions may be appropriate, depending on the module –Polling code tends to structurally force an early decision that’s difficult to change later

Danger: Upward Dependency Lower levels are often shared among different upper levels (“clients”) Clients should be insulated from failures in other clients Solution: –Separate shared data into global and client- specific variables –Never upcall while holding a lock on global data –Never upcall in a thread you’re afraid to kill

Danger: Indirect Recursion (1) What if a layer downcalls in an upcall? –Downcall might change data in unexpected ways –Or it might just deadlock, if it tries to grab a lock held during the upcall No one solution, but three good options Possible solution #1: never hold locks during upcalls, reevaluate everything on return –Leads to clumsy and inefficient programs –Definitely a last-resort solution

Danger: Indirect Recursion (2) Possible solution #2: prohibit most/all recursive downcalls –Seems very restrictive, but it usually makes sense –Most upcalls ask simple questions and should return quickly, anyway –We can change the interface to make this okay Possible solution #3: the lower level enqueues recursive requests for later –This adds a lot of complexity to the lower level

Conclusions Calls naturally flow both up and down layers of abstraction –But upcalls pose some subtle dangers you have to compensate for Modules which need to be protected from each other can still share an address space –But you need a language with strong typing