280 likes | 324 Views
The Structuring of Systems Using Upcalls. David D. Clark. Overview. A method for implementing layers with synchronous procedure calls between layers Upcalls – flow of control by a lower layer calling an upper layer via procedure call
E N D
The Structuring of SystemsUsing Upcalls David D. Clark Frank Sliz, CS533, Upcalls
Overview • A method for implementing layers with synchronous procedure calls between layers • Upcalls – flow of control by a lower layer calling an upper layer via procedure call • Multi-task module – subroutines in different tasks that make up the layer Frank Sliz, CS533, Upcalls
Outline • Background • Upcalls and Multi-task Modules • Example • Advantages • Swift Operating System • Problems • Conclusions Frank Sliz, CS533, Upcalls
Background • 1968 – THE operating system • Great interest in using layers to structure OS • 1982 – ISO model for network communication • 1985 – Swift operating system Frank Sliz, CS533, Upcalls
Monolithic Operating System Frank Sliz, CS533, Upcalls
Layered Operating System Frank Sliz, CS533, Upcalls
Advantages of Layered OS • Modularity • Easier to test and debug • Easier to modify • Acyclic dependency • Verification • Trustworthiness Frank Sliz, CS533, Upcalls
7-Layer OSI Model 7 application 6 presentation 5 session 61 4 transport 3 network 2 data link 1 physical Frank Sliz, CS533, Upcalls
Disadvantages of Layered OS • Performance • Asynchronous communication between layers • Buffering of data between layers • Copying of data for crossing protection boundary • Programming complexity • Inefficient support for upward flow of control Frank Sliz, CS533, Upcalls
Upcalls and Multi-Task Modules • Upcalls • Flow of control by a lower layer calling an upper layer via procedure call • Multi-Task Modules • Subroutines in different tasks that make up the layer • Subroutines are callable from above or below via procedure calls • State variables in shared memory Frank Sliz, CS533, Upcalls
System Organization Frank Sliz, CS533, Upcalls
Example - Network Protocol3 Layers and 3 Tasks Display Transport Network Create Receive Send Frank Sliz, CS533, Upcalls
Control Flow in Network Protocol Display Layer Transport Layer Network Layer Frank Sliz, CS533, Upcalls
Example - Display LayerNetwork Protocol Frank Sliz, CS533, Upcalls
Example - Transport LayerNetwork Protocol Frank Sliz, CS533, Upcalls
Example Network LayerNetwork Protocol Frank Sliz, CS533, Upcalls
Example – Create Task Frank Sliz, CS533, Upcalls
Example – Receive Task Frank Sliz, CS533, Upcalls
Example – Send Task Frank Sliz, CS533, Upcalls
Advantages of Upcalls • Upward, synchronous flow via procedure call is more efficient than IPC • No need for data buffering between layers • Simplicity of implementation • Lower layer can ask advice from upper layer resulting in simplification of algorithm Frank Sliz, CS533, Upcalls
Advantages of Multi-Task Modules • Subroutine interfaces are easier to deal with than IPC interfaces • No system wide IPC message format needed • Decisions about task usage can be made later, the tasks are not hard coded into the layers • Acknowledgements can be sent with new data packet - Piggybacking Frank Sliz, CS533, Upcalls
Swift Operating System • Explore upcall and multi-module usage • Single address space with a typesafe language • Monitor locks for access to shared state • Initially used for network protocols • Test to determine if useful in other contexts • Develop solutions for upcall problems Frank Sliz, CS533, Upcalls
Problems with Upcall • Violates basic principle of layering • upcall failure could leave lower layer left in unstable condition • Recovery of resources when an upcall fails • Upcall gets into an infinite loop Frank Sliz, CS533, Upcalls
Mitigating Upcall Failures • 2 classes of data • Client or private data which is expendable • Data shared between tasks must be unlocked and consistent before upcall • Expendable tasks • Layer-specific cleanup via system procedures • Timer or User to detect infinite loop Frank Sliz, CS533, Upcalls
Solutions to Indirect Recursive Call • Put state variables in consistent state before upcall and then reevaluate them upon return • Prohibit recursive downcall – variables can be left locked and inconsistent when upcalling • Downcall queues the work for later execution • Downcall is restricted in its actions • Downcall is replaced by extra arguments or it is replaced by a second upcall to query Frank Sliz, CS533, Upcalls
Problems with Multi-Task Modules • Failure to use monitor locks properly which can cause incorrect results • With single shared memory address space program bugs can corrupt memory • Need queues for suspended tasks waiting to obtain monitor locks Frank Sliz, CS533, Upcalls
Conclusions • Methodology is useful for operating systems • upcalls and multi-task modules are efficient • Strongly checked typesafe language should be used in a single shared address space • useful for network protocols, text editors, and I/O • Bad idea to implement a layer as a process • Parallel systems need shared memory for efficient communication between processes Frank Sliz, CS533, Upcalls