Language Support for Fast and Reliable Message-based Communication in Singularity Manuel Fähndrich, Mark Aiken, Chris Hawblitzel, Orion Hodson, Galen Hunt,

Slides:



Advertisements
Similar presentations
1 Symbian Client Server Architecture. 2 Client, who (a software module) needs service from service provider (another software module) Server, who provide.
Advertisements

Operating Systems Components of OS
Writing specifications for object-oriented programs K. Rustan M. Leino Microsoft Research, Redmond, WA, USA 21 Jan 2005 Invited talk, AIOOL 2005 Paris,
MicroKernel Pattern Presented by Sahibzada Sami ud din Kashif Khurshid.
MPI Message Passing Interface
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.
CS 443 Advanced OS Fabián E. Bustamante, Spring 2005 Resource Containers: A new Facility for Resource Management in Server Systems G. Banga, P. Druschel,
Remote Procedure Call (RPC)
Extensibility, Safety and Performance in the SPIN Operating System Presented by Allen Kerr.
Remote Procedure CallCS-4513, D-Term Remote Procedure Call CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
Lightweight Remote Procedure Call Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy Presented by Alana Sweat.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
G Robert Grimm New York University Extensibility: SPIN and exokernels.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
Extensibility, Safety and Performance in the SPIN Operating System Brian Bershad, Stefan Savage, Przemyslaw Pardyak, Emin Gun Sirer, Marc E. Fiuczynski,
Active Messages: a Mechanism for Integrated Communication and Computation von Eicken et. al. Brian Kazian CS258 Spring 2008.
3.5 Interprocess Communication
Improving IPC by Kernel Design Jochen Liedtke Shane Matthews Portland State University.
OOP #10: Correctness Fritz Henglein. Wrap-up: Types A type is a collection of objects with common behavior (operations and properties). (Abstract) types.
1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those.
Figure 1.1 Interaction between applications and the operating system.
Exokernel: An Operating System Architecture for Application-Level Resource Management Dawson R. Engler, M. Frans Kaashoek, and James O’Toole Jr. M.I.T.
User-Level Interprocess Communication for Shared Memory Multiprocessors Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy Presented.
1 I/O Management in Representative Operating Systems.
Extensibility, Safety and Performance in the SPIN Operating System Ashwini Kulkarni Operating Systems Winter 2006.
Presentation of Singularity OS Seminar, winter 2005 by Jacob Munk-Stander November 23 rd, 2005.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Chapter 3.5 Memory and I/O Systems. 2 Memory Management Memory problems are one of the leading causes of bugs in programs (60-80%) MUCH worse in languages.
Remote Procedure Calls Adam Smith, Rodrigo Groppa, and Peter Tonner.
Ed Nightingale, Orion Hodson, Ross McIlroy, Chris Hawblitzel, Galen Hunt MICROSOFT RESEARCH Helios: Heterogeneous Multiprocessing with Satellite Kernels.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
CE Operating Systems Lecture 3 Overview of OS functions and structure.
 Remote Procedure Call (RPC) is a high-level model for client-sever communication.  It provides the programmers with a familiar mechanism for building.
Writing Systems Software in a Functional Language An Experience Report Iavor Diatchki, Thomas Hallgren, Mark Jones, Rebekah Leslie, Andrew Tolmach.
OSes: 3. OS Structs 1 Operating Systems v Objectives –summarise OSes from several perspectives Certificate Program in Software Development CSE-TC and CSIM,
Processes Introduction to Operating Systems: Module 3.
EXTENSIBILITY, SAFETY AND PERFORMANCE IN THE SPIN OPERATING SYSTEM
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
Silberschatz, Galvin and Gagne  Operating System Concepts UNIT II Operating System Services.
Networking Implementations (part 1) CPS210 Spring 2006.
Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy. Presented by: Tim Fleck.
Processes and Virtual Memory
AMQP, Message Broker Babu Ram Dawadi. overview Why MOM architecture? Messaging broker like RabbitMQ in brief RabbitMQ AMQP – What is it ?
MIDORI The Windows Killer!! by- Sagar R. Yeole Under the guidance of- Prof. T. A. Chavan.
1 Channel Access Concepts – IHEP EPICS Training – K.F – Aug EPICS Channel Access Concepts Kazuro Furukawa, KEK (Bob Dalesio, LANL)
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
CS533 Concepts of Operating Systems Jonathan Walpole.
Scott Finley University of Wisconsin – Madison CS 736 Project.
Implementing Remote Procedure Call Landon Cox February 12, 2016.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Lecture 1 Page 1 CS 111 Summer 2013 Important OS Properties For real operating systems built and used by real people Differs depending on who you are talking.
Module 12: I/O Systems I/O hardware Application I/O Interface
CS533 Concepts of Operating Systems
Fabric Interfaces Architecture – v4
Chapter 3: Operating-System Structures
CSE 451: Operating Systems Autumn 2003 Lecture 16 RPC
Operating System Concepts
13: I/O Systems I/O hardwared Application I/O Interface
CS703 - Advanced Operating Systems
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Basic Concepts Protection: Security:
Hardware Works, Software Doesn’t: Enforcing Modularity with Mondriaan Memory Protection Emmett Witchel Krste Asanović MIT Lab for Computer Science.
Improving IPC by Kernel Design
Chapter 2: Operating-System Structures
Presented by: SHILPI AGARWAL
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Outline Chapter 2 (cont) Chapter 3: Processes Virtual machines
CSE 451: Operating Systems Winter 2003 Lecture 16 RPC
Chapter 2: Operating-System Structures
Module 12: I/O Systems I/O hardwared Application I/O Interface
Presentation transcript:

Language Support for Fast and Reliable Message-based Communication in Singularity Manuel Fähndrich, Mark Aiken, Chris Hawblitzel, Orion Hodson, Galen Hunt, James R. Larus, and Steven Levi Microsoft Research EUROSYS 2006

Manuel FähndrichMicrosoft Research2 Singularity Research goal –Leverage state of the art to build more reliable software High-level languages, memory and type safety Advanced type systems, formal verification Optimizing compilers and typed assembly language –Don’t sacrifice performance, unless safety requires it The Singularity OS –Micro-kernel architecture separate processes for services (drivers) processes and kernel communicate solely via channels no shared memory –Ideal research platform –Written in Sing# (a C# extension) This talk: –Programming language support for Singularity’s process isolation

Manuel FähndrichMicrosoft Research3 VolMgr Process Isolation Isolation guarantee stems from static memory safety –No hardware protection –All code runs in ring0 on x86 processor –Each process has own heap + garbage collector Channels are sole form of communication –point-to-point –serve as APIs (default Kernel API is minimal) Kernel DiskDevFS NS App

Manuel FähndrichMicrosoft Research4 Challenges Pervasive message passing –Difficult programming model What’s the protocol? Are we sending the right message at the right time? Are we handling all messages? –Perceived as expensive Copying of message content between processes limits performance –Situation worse in Singularity due to fine grained isolation Queue, memory management Cost of using a high-level language and GC –Another talk

Manuel FähndrichMicrosoft Research5 Sing#: Easy message passing Know thy protocol –Explicit channel contracts describe messages message arguments valid message sequences (finite state machine) –Enables compile-time checking exhaustiveness of selects sends in correct state finite buffering requirement Pass ownership of message data, not a copy … but prove its correctness Direct support for channels in programming language

Manuel FähndrichMicrosoft Research6 Outline Motivation Channels Data ownership Implementation Performance Conclusion

Manuel FähndrichMicrosoft Research7 Channels Consist of two endpoints (point-to-point) Each endpoint owned by at most one thread at any time Communication is asynchronous, delivery in order –Sends never block (nor fail) –Receives can block (or indicate channel closure) Endpoints can be passed as messages –Network configuration evolves dynamically Governed by channel contract –Messages –Message arguments –Valid message sequences

Manuel FähndrichMicrosoft Research8 Channel model in pictures Kernel Name Server I III II create channel Kernel IV spawn

Manuel FähndrichMicrosoft Research9 P1 Kernel creates a process I IIIIV II Kernel Name Server Kernel Name Server Kernel Name Server send a over b a b Kernel Name Server spawn

Manuel FähndrichMicrosoft Research10 Channel contracts contract NIC { // Network device interface in message NICParameters(…); in message Buffer(char[] in ExHeap buf); in message Reconfigure(); in message Exit(); out message BufferAck(int count); out message Configured(); out message BadParameters(); state START: one { NICParameters?  CONFIGURING; } state CONFIGURING: one { Configured!  READY; BadParameters!  START; } state READY: one { Buffer?  BufferAck!  READY; Reconfigure?  START; Exit?  DONE; } state DONE: ; } START CONFREADY DONE RDY$0 NICParameters? BadParameters! ReConfigure? Configured! Exit? BufferAck! Buffer?

Manuel FähndrichMicrosoft Research11 Channel operations Endpoint types NIC.Imp (importing side) NIC.Exp (exporting side) Channel creation NIC.NewChannel( out Nic.Imp imp, out Nic.Exp exp); Sends are methods on endpoints Receive patterns block until a case is satisfied NIC.Exp:READY client; ServiceProvider.Exp:START provider; … switch receive { case client.Buffer(buf): queue.Add(buf); client.SendBufferAck(queue.Size); break; case client.Reconfigure(): … case client.ChannelClosed() && provider.ChannelClosed(): … break; … }

Manuel FähndrichMicrosoft Research12 B Ownership transfer Only exchangeable data can be sent Ownership invariant –Exchangeable data is owned by exactly one thread at any time. Transfer by pointer, not copy (but semantically equiv.) –Proof obligations No use after ownership transfer (e.g. free or send) No leaks (missing free/send) –Like manual memory management –Compiler checks invariant statically A A B

Manuel FähndrichMicrosoft Research13 Tracked Data Challenge: statically prove correct memory management Segregate tracked and non-tracked data Tracked types –ExHeap pointers: S* in ExHeap –ExHeap vectors: char[] in ExHeap –rep structs S: do not contain GC pointers Strongly typed at MSIL level –allows runtime bounds checking for vectors

Manuel FähndrichMicrosoft Research14 Ownership Tracking Method parameters –either borrowed for the call duration void FillBuffer(byte[] in ExHeap b); –or claimed void SendBuffer([Claims] byte[] in ExHeap b); void Free([Claims] void* in ExHeap b); Method result –ownership always passes to caller Complications –Data structures and vectors –Nested pointers owned by containing structure –Restricted to tree structures to make tractable

Manuel FähndrichMicrosoft Research15 Where are the efficiency gains? Channel endpoint invariants –Single owner: no locking on send/receives Channel contract invariants –Finite queue size: no allocation on send or receive –Endpoint passing: no complicated locking/races Data ownership invariants –No copying of data: pass by pointers Programmer productivity –Simple message passing model and contract enforcement

Manuel FähndrichMicrosoft Research16 Channel Implementation Pre-allocate space to hold message arguments in endpoints Channel= cross-linked structure in memory Send= write into peer + signal event Receive= check tag + read arguments CStates state; C.Exp* peer; M mbuffer0; M mbuffer1; N nbuffer0; CTags tag0; CTags tag1; … C.Imp CStates state; C.Imp* peer; … C.Exp

Manuel FähndrichMicrosoft Research17 Message size benchmark

Manuel FähndrichMicrosoft Research18 Summary and Future Work Singularity uses message passing pervasively –So far, channels have not been our performance bottle neck –Programmers have stopped complaining Channel contracts help specify interfaces > 43 distinct channel contracts with 135 distinct states > 500 distinct messages 146 messages transferring pointers 42 messages transferring endpoints Static verification of ownership invariant successful –Dangling pointer accesses, double frees or leaks not been a problem. Future work –Ownership and protocol verification on exception paths –Programmer defined asynchronous abstractions –Pre-condition, post-conditions and invariant verification

Manuel FähndrichMicrosoft Research19 Questions?

Manuel FähndrichMicrosoft Research20 Backups

Manuel FähndrichMicrosoft Research21 Transfer of ownership Transfer by pointer, not copy (but semantically equiv.) Proof obligations –No use after ownership transfer (e.g. free or send) –No leaks (missing free/send) Like manual memory management Process Heaps (GC) Exchange Heap (manual)

Manuel FähndrichMicrosoft Research22 Transfer of ownership Transfer by pointer, not copy (but semantically equiv.) Proof obligations –No use after ownership transfer (e.g. free or send) –No leaks (missing free/send) Like manual memory management Process Heaps (GC) Exchange Heap (manual)

Manuel FähndrichMicrosoft Research23 Endpoint Abstractions ESet and EMap Sets of endpoints in the same state Can add endpoint to sets void ESet.Add([Claims] E ep); Can wait for messages on any endpoint in a set ESet eset; switch receive { case ep.M(x) in eset: … // ep and x bound

Manuel FähndrichMicrosoft Research24 P1 2 processes connect I IIIIV II Kernel Name Server P2 P1 Kernel Name Server P2 P1 Kernel Name Server P2 P1 Kernel Name Server P2