the architecture of an os
play

The Architecture of an OS Monolithic Operating Systems Structure - PowerPoint PPT Presentation

The Architecture of an OS Monolithic Operating Systems Structure and Layered Processes Virtual Machine, Library, Exokernel Micro kernel and Client/Server Otto J. Anshus Hybrids University of Troms/Oslo 27.08.03 1


  1. The Architecture of an OS • Monolithic Operating Systems Structure and • Layered Processes • Virtual Machine, Library, Exokernel • Micro kernel and Client/Server Otto J. Anshus • Hybrids University of Tromsø/Oslo 27.08.03 1 27.08.03 2 User Service Service process Goals of the architecture Service Service S O n i e c i v r e s a • OS as Resource Manager l l a C • OS as Virtual Machine (abstractions) Operating System Interrupt handler: • Efficiency, flexibility, size, security, … as Kernel Start requested service discussed earlier Start (next?) user program Services Interrupt Hardware Overhead •UL -> KL Data from network •UL address space -> UL addr. space 27.08.03 3 27.08.03 4

  2. Monolithic Layered Structure • All kernel routines are • Hiding information at User User program program Level N together each layer . return . • A system call interface • Develop a layer at a time . call • Examples: • Examples Level 2 – Linux – THE (6 layers, entry semaphores, Dijkstra Level 1 – Most Unix OS Kernel 1968) – NT (hybrid) many many things Hardware – MS-DOS (4 layers) 27.08.03 5 27.08.03 6 Microkernel and Client/Server Virtual Machine "A running program is often referred to as a virtual machine - a machine that doesn't • Micro-kernel is “micro” exist as a matter of actual physical reality. The virtual machine idea is itself one of the User Services most elegant in the history of technology and is a crucial step in the evolution of ideas program • Services are implemented about software. To come up with it, scientists and technologists had to recognize that as user level processes return a computer running a program isn't merely a washer doing laundry. A washer is a call washer whatever clothes you put inside, but when you put a new program in a • Micro-kernel get services computer, it becomes a new machine.... The virtual machine: A way of understanding on behalf of users by software that frees us to think of software design as machine design." messaging with the service entry processes From David Gelernter's "Truth, Beauty, and the Virtual Machine," Discover µ− kernel Magazine, September 1997, p. 72. • Example: L4, Nucleus, Taos, Mach, NT (hybrid) 27.08.03 7 27.08.03 8

  3. Virtual Kernel Mode Virtual Machine Virtual User Mode User Mode • Virtual machine monitor – provide multiple virtual “real” hardware user user – run different OS codes OS 1 OS n Syscall • Example trapped . . . VM 1 VM n – IBM VM/370: Started in the Privileged instructions 70’s. Check out trapped – virtual 8086 mode Small kernel – Java VM – VMware Bare hardware Kernel Mode – Exokernel Exact copies of the bare hardware 27.08.03 9 27.08.03 10 Virtual 8086 Java VM 27.08.03 11 27.08.03 12

  4. Hardware Support • What is the minimal support? • 2 modes • Exception and interrupt trapping • Can virtual machine be protected without such support? • Yes, emulation instead of executing on real machine 27.08.03 13 27.08.03 14 Pro et Contra “Truths” on Micro Kernel Flexibility and Micro kernel Monolithic Layered VM C/S Performance •Performance •Many virtual •Clean, less bugs •Clear division of •More flexible computers with labour •Clear division of •Small means less different OS’es • A micro kernel restricts application level flexibility. labour bugs+manageable •Test of new OS • Switching overhead kernel-user mode is inherently expensive. •Distributed systems while production • Switching address-spaces is costly. work continues •Failure isolation of NO: Can be <50 cycles services at Kernel Level •All in all: • IPC is expensive. flexibility NO: 6-20 microsec round-trip, • Micro kernel architectures lead to memory system degradation. 53-500 cycles/IPC one way •More •Performance •Performance •Performance •Flexibility issues? • Kernel should be portable (on top of a small hardware- unstructured issues? issues? issues? •Performance issues? dependent layer). •Complexity issues? Taken from J. Liedtke, SOSP 15 paper: ”On micro kernel construction” 27.08.03 15 27.08.03 16

  5. Flow of Execution Concurrency and Process (Assume R to disk => long wait 10- P1 : Input syscall Int0x80 100’s ms) • Problem to solve Trap handling; Scheduler; – A shared CPU, many I/O devices and lots of Dispatch; interrupts P2 : CPU bound “Input finished” interrupt – Users feel they have machine to themselves Kernel Mode • Answer Trap handling; (Could have started another Scheduler; Dispatch; process than P1 ) User Mode – Decompose hard problems into simple ones P1 : CPU bound – Deal with one at a time 10-100ms Timer – Process is such a unit Trap handling; Scheduler; Dispatch; 27.08.03 17 27.08.03 18 Procedure, Co-routine, Thread, Process Procedure and Co-routine Main A B 1 • Procedure, Function, (Sub)Routine Call A; “User Yield when finished” Call B; • Call-execute all-return nesting 1 Return 2 User level non preemptive “scheduler” • Co-routine Call B; 2 in user code • Call-resumes-return Return • Thread (more later) Main A B • Process Call A; Call B; Resume A; “User Yield during execution – Single threaded to share CPU” Resume B; – Multi threaded Resume A; Never executed Return 27.08.03 19 27.08.03 20

  6. Program and Process For at least one Process thread of execution • Sequential execution of operations main() PID { main() – No concurrency inside a ( single threaded) process ... heap { – Everything happens sequentially foo() ... stack ... • Process state foo() main } ... foo – Registers } registers – Stack(s) foo() The PC { – Main memory foo() context ... { – Files in UNIX } Resources: ... – Communication ports comm. ports, } files, – Other resources Program semaphores Process 27.08.03 21 27.08.03 22 Instruction Pointer Process State Transitions (program counter) in the EIP register U s e r L e v e l P r o c e s s e s Process vs. Program MULTIPROGRAMMING P1 P2 P3 P4 •Uniprocessor: Interleaving (“pseudoparallelism”) KERNEL • Process > program Trap Service •Multiprocessor: Overlapping (“true Handler paralellism”) – Program is just part of process state Trap Return P2 BlockedQueue Handler – Example: many users can run the same program P3 P4 Scheduler ReadyQueue r terminate e l • Process < program u h d c e t Running h a Wait for c p Current P1 S s resource Dispatcher i d PCB’s – A program can invoke more than one process Create – Example: Fork off processes to lookup webster a process Memory resident part Ready Blocked Resource becomes 27.08.03 23 27.08.03 available 24

  7. Process Control Block (Process Table) Process State Transition • What r e terminate l u h d c – Process management info e t W h a Running c p r a S s e • State (ready, running, blocked) i i s d t o f u o • Registers, PSW, parents, etc r r c e Create – Memory management info a process • Segments, page table, stats, etc Ready Blocked – I/O and file management • Communication ports, directories, file descriptors, etc. Resource becomes available 27.08.03 25 27.08.03 26 Discussion: What needs to be saved and restored …and how? on a context switch? • Volatile state • Save (volatile machine state, current process); • Program counter (Program Counter (PC) also called Instruction • Load (another process’s saved volatile state); Pointer (Intel: EIP)) • Processor status register • Start (new process); • Other register contents • User and kernel stack pointers • A pointer to the address space in which the process runs • the process’s page table directory 27.08.03 27 27.08.03 28

  8. Threads and Processes Project OpSys Trad. Threads Processes in individual address spaces Process Kernel threads User Level Threads Kernel Address Space Kernel Level 27.08.03 29

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend