Download presentation
Presentation is loading. Please wait.
1
Kernel Design & Implementation
2
The Problems Kernel code is notoriously complex:
Concurrency control Device drivers Interrupts Low-level hardware details Functionality is every increasing Debugging is slow Must reboot after every change
3
Yet More Problems How to develop a new operating system?
How to maintain an operating system Fixing bugs Improving technology Adding new features Maintaining backward compatibility Operation across different hardware platforms
4
Kernel Types Simple monitor/library: e.g. DOS
Monolithic piece of software: e.g. UNIX Micro-kernels: e.g. Mach Virtual Machines (VM): e.g. IBM CMS/VM Layered OS: e.g. Windows NT Extensible kernels: SPIN
5
Simple Monitor/Library
Applications + OS co-exist in supervisor mode Share the same memory space Applications have direct access to devices Operating system has limited functionality No meaningful user accounting or security Operating system relies on application to solve problems: e.g. overlaying, EMS
6
Example: DOS DOS * No virtual memory * No protection I/O
* One application at a time * Direct I/O I/O Frame buffer Application DOS interrupt vector Hardware vector (to the BIOS)
7
Simple Monitor/Library in Balance
Advantages: Performance No context switching Direct I/O access No VM overhead Flexibility Applications can change OS behavior Disadvantages No safety or security No VM No multiprogramming OS cannot protect or manage I/O effectively
8
TSR Terminate-and-Stay-Resident: On a timer interrupt:
Application overwrites OS vector for timer interrupt Timer interrupts invoke an application routine Application “exits” (not really) On a timer interrupt: TSR application is invoked TSR application runs TSR application calls OS timer interrupt routine TSR application returns to the “current application”
9
TSR cont’d More TSR applications could be added
New TSR overwrites old TSR timer interrupt entry On a timer interrupt: Newest TSR is invoked, runs, then passes control to the next TSR application… All the way to oldest TSR application which finally invokes the OS TSR programs are thus chained through the interrupt vector
10
Expanded Memory System (EMS)
To overcome limits of 1M addressing without having to do overlaying Uses special hardware to allow remap a memory address range (16K) to a different range of physical pages Programmer tells system which physical range to remap Mimicks virtual memory, but all are physical addresses!!!
11
EMS Additional physical memory Addressable memory (1M)
Unit of remapping in EMS is 4 pages (16K) Up to 64K units of 16Kbytes each No virtual addressing, EMS != virtual memory
12
Monolothic Kernels Kernel is one big piece of software
Runs in supervisor mode while applications run in user mode Mostly modular design, but interfaces may not be well defined
13
Example: UNIX Kernel consists of major modules
naming basic file system process implementation and scheduling memory and paging network protocol support There is no clear layering or separation of functions: Modules can call each other in different ways
14
UNIX File system Process Memory Network Devices
15
Micro-Kernels To control the complexity of the OS
A small kernel that does: Fast interprocess communications/RPC Device control Basic process implementation (e.g. context switching) Basic memory management implementation (e.g. mapping memory pages, handling TLB/page tables) Interrupt processing support OS is implemented by user-level processes
16
Micro-Kernels Applications Process Scheduler Memory Mgr. Network
Protocol File System Micro-Kernel
17
Implementing Fork Parent process sends an RPC to the process manager (through the micro-kernel) Process manager sends an RPC to the memory manager (through the micro-kernel) Memory manager allocates memory, calls micro-kernel to map the pages/and/or do copy-on-write Memory manager replies to process manager, which creates process Process manager replies to parent process
18
Sending a Network Message
Application program sends an RPC containing the message to the network manager Network manager forms the necessary packets (e.g. TCP/IP), opens the network device (through micro-kernel), and sends packets through device Network manager replies to application program (or perhaps it replies immediately in case if it is a non-blocking operation)
19
Observations In a monolithic kernel, process module would call memory module, etc. Therefore: A micro-kernel replaces inter-module procedure calls with remote procedure calls No shared memory between OS processes Extra data copying
20
Micro-Kernels in Balance
Advantages Development and maintenance of OS processes are easier Change one OS process without changing the rest Easy to add more functionality (e.g. DOS personality) Disadvantages Performance Cost of RPC becomes very important
21
Compatibility with Legacy Code
Applications Process Scheduler Memory Mgr. Network Protocol File System UNIX Server 3. reply 1. Trap 2. Message 4. return Micro-Kernel
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.