Structuring of Systems using Upcalls David D.Clark Presented by Madhura S Rama
Agenda Goal Layers and Upcalls Multitask Modules Control Flow in a N/W Protocol routine Advantages of Upcalls Advantages of Multitask Modules Issues Other Features Conclusion My View
Goal Propose a design methodology suitable for operating system programs which Permits synchronous procedure call between layers in both upward and downward direction. Provides runtime support for highly interactive parallel software packages Swift OS built to implement this methodology
Layered Architecture Traditionally, layer below provides services to layer above. Flow of control – Top-down Each layer is usually implemented as a process Uses asynchronous message passing for communication between layers Inefficient – requires context switches, inter process communication and data buffering.
Swift Layered Architecture Layer provides service to layer above or below depending on the flow of control – called Upcalls Each layer is an encapsulated multitask module Implemented using a single address space For storing variables For efficient passing of data between layers
Multitask Modules Each layer defined as a collection of subroutines – called multitask modules Subroutines live in number of tasks in a layer Layers communicate through subroutine calls Each layer contains private state which are accessible through shared memory Various tasks in a layer communicate using state variables
Layering and Upcalls Swift Layer TCP/IP Layer FTP Client TCP IP Process Multitask Modules TCP Inter-process Communication IP Thread / task Ethernet Driver Subroutine Calls Ethernet Tasks
Ex: Control Flow in a N/W Protocol routine Display_start receive Get_data Keyboard_ handler Display Layer wakeup Transport_open receive Get_port send Arm_send Transport Layer wakeup Net_open Net_receive Net_dispatch Net_send Network Layer Create task wakeup Interrupt Handler
Advantages Of Upcalls: Of Multitask Modules: Efficient - Subroutine call cheaper than IPC Simplicity of implementation Piggybacking achieved effectively Of Multitask Modules: Easier to understand and less threatening Decisions about how tasks are used need not be defined until late in design time
Issue 1 Lower layer left in inconsistent state when upper layer fails during upcall Solution: Partition the data Make that task non-essential and throw it away Mediate the resources used between the client and the layers and run a cleanup procedure
Issue 2 How to distinguish between a task in a loop and the one running for a long time? Solution: Use timers Make a human oversee it
Issue 3 Violation of trust between lower layers Solution: Programmers need to be skilled enough to organize the resources properly
Issue 4 Indirect Recursive Call Solution: Put variables on a consistent state and reevaluate on call return Prohibit an upcall from making any recursive downcall Queue the work request for later execution Make the recursive call set flags for later examination Replace the downcall by extra return arguments to upcall/ another upcall to query the client
Issue 5 Modules failing to use monitor locks properly Solution: Requires programming discipline
Other Features Task Scheduling Address Space Management Associate dynamic priority to tasks scheduled Deadline promotion Address Space Management Use CLU to avoid propagation errors in a single address space Garbage Collection
Conclusion Realizing a layer as a process is a bad idea Upcalls are simple and efficient Swift OS is portable Suitable for Network protocols and text editors Not suitable for large applications like compilers Efficiency of the system depends on the skill level of the programmer
My View If efficiency is one of the goals then, garbage collection should not be used as it is inefficient System cannot be tested layer by layer as the call flow is in both direction. Makes debugging difficult. As calls are in both direction, order of acquiring the locks cannot be enforced – Might lead to deadlocks. Selecting the correct layered architecture is a tradeoff between “Safety and Performance”
Questions????