Winter CMPE 155 Week 2
Winter Review? Computers Operating Systems Kernels Distributed Systems
Winter Computer “Hardware”. Processor(s), main memory, disk(s), keyboard, display(s), network interface, other I/O devices.
Winter Multiple Processor Systems (1) “Tightly-coupled” –Shared-memory muliprocessor P …… Shared Memory
Winter Multiple Processor Systems (2) “Less tightly-coupled” –Message-passing multicomputer P …… M P M P M P M
Winter Multiple Processor Systems (3) “Loosely-coupled” –Distributed systems” Network Computer
Winter What is an OS? Machine/resource manager. Physical Devices Microarchitecture Instruction Set Architecture Operating System Compilers, Editors, etc. Hardware Application programs
Winter OS as extended machine… Top-down view. Layer of software that hides hardware. Provides programmer easier instructions. –E.g., read block from file. (Part of) the OS runs in supervisor (privileged) mode: can execute priviledged instructions (e.g., access to physical decices through drivers).
Winter OS as resource manager Bottom-up view. Provides orderly and controlled allocation of resources. Provides (“concurrent”) programs (fair) access to resources (processor, disk, printer). Time (e.g., CPU) and space (e.g., memory) multiplexing.
Winter OS History
Winter First generation: Vacuum tubes: machines took whole rooms! Machine language programming (plugboard wiring). No OS.
Winter Second generation: Transistors made computers commercially viable. Builders, operators, users. Mainframes: multimillion dollar machines. Punch cards, input and output tapes. Batch systems.
Winter Third generation: ICs. Multiprogramming. –Machine shared by “concurrent” programs. –Memory partitions hold multiple jobs. Timesharing. –Multiprogramming still batch processing: scientific computation and commercial data processing. –Cheap terminals: interactive use. –Interactive service + batch processing.
Winter Fourth generation: 1980-… High-scale circuit integration. Computer miniaturization. Mainframes -> minicomputers -> microcomputers or PCs. PC OSs: CP/M, DOS, MS-DOS. GUI-based OSs: UNIX-based, MS Windows-based, MAC OS, …
Winter Modern OSs Mainframe OSs: IBM’s OS/390, DEC’s VMS. Server OSs: Solaris, FreeBSD, etc. PC OS: Linux, MacOS, Windows… Real-time OSs: VxWorks. Embedded OSs: Linux, PalmOS, Windows CE Smart card OSs
Winter Basic OS Concepts
Winter Processes Process: program in execution. –Address space: memory usable by program (text, data, stack). –State: registers. OS uses process table to keep track of processes. Processes can create other (child) processes.
Winter Inter-Process Communication (IPC) Shared memory. –Processes communicate/synchronize through a shared data item. Message passing. –Processes communicate via messages.
Winter Shared Memory Processes must access shared data in a mutual exclusive way. Primitives: –Semaphores: Dijkstra(1965) P(S) and V(S) operations. Atomic (indivisible) operations. –(Conditional) Critical Regions –Monitors
Winter Message Passing Processes communicate/synchronize by sending/receiving messages. Primitives: –Send(message), receive(message). Issues: –Synchronous versus asynchronous. –Reliable versus unreliable.
Winter Distributed Shared Memory Sharing data among computers that don’t share physical memory. DSM provides shared memory abstraction. –Read- and write-like primitives. Needs message passing to convey updates among physically disjoint processing elements.
Winter Deadlocks Shared data/resource may lead to deadlock: processes get “stuck”. Example: v is using r1 and requests r2; w is using r2 and requests r1. vw
Winter Memory Management Share memory among several processes. Monoprogramming: memory sharing between OS and program (embedded OSs). Multiprogramming: multiple processes (partially or totally) in memory. –Swapping. –Virtual memory: paging.
Winter I/O OS I/O subsystem manages I/O devices. –Device-dependent (device drivers) or independent. File system: –File as an abstraction. –Basic operations: create, delete, read, write. Hierarchical file systems. –Dynamically attach tree branches (e.g., mount system call in UNIX). Access control: permissions.
Winter System Calls Interface between OS and user program: set of system calls. –E.g., access a file, create a process, etc. Like making a special procedure call. –System calls executed by kernel. –Calling program pushes parameters onto stack; calls library; library routine (same name as system call) executes TRAP, switching to kernel mode; OS handles call; returns control to library; library returns to user program. Example system calls for file system –open, close, read, write, mkdir, rmdir.
Winter System Calls User-level process Kernel Physical machine System call to access physical resources System call: implemented by hardware interrupt (trap) which puts processor in supervisor mode and kernel address space; executes kernel-supplied handler routine (device driver) executing with interrupts disabled.
Winter Kernels Executes in supervisor mode. –Privilege to access machine’s physical resources. User-level process: executes in “user” mode. –Restricted access to resources. –Address space boundary restrictions.
Winter Kernel Functions Memory management. –Address space allocation. –Memory protection. Process management. –Process creation, deletion. –Scheduling. Resource management. –Device drivers/handlers.
Winter Kernel and Distributed Systems Inter-process communication: RPC, MP, DSM. Distributed (Networked) File systems. Some parts may run as user-level and some as kernel processes.
Winter Be or not to be in the kernel? Monolithic kernels versus microkernels.
Winter Monolithic kernels Examples: Unix, Sprite. “Kernel does it all” approach. Based on argument that inside kernel, processes execute more efficiently and securely. Problems: massive, non-modular, hard to maintain and extend.
Winter Microkernels Take as much out of the kernel as possible. Minimalist approach. Modular and small. –10KBytes -> several hundred Kbytes. –Easier to port, maintain and extend. –No fixed definition of what should be in the kernel. –Typically process management, memory management, IPC. Example: Mach (CMU),
Winter Micro- versus Monolithic Kernels S1S4S3 S4 S1S4S2S3 Monolithic kernel Microkernel Services (file, network). Kernel code and data
Winter Microkernel Application OS Services Microkernel Hardware. Services dynamically loaded at appropriate servers.. Some microkernels run service processes user space; others allow them to be loaded into either kernel or user space.
Winter Extensible Kernels “Extensible” OS. Provides core set of extensible services + extension infrastructure. Extensions: allow applications to specialize the underlying OS to achieve performance and functionality. –Extensions can be loaded into kernel any time. Example: general purpose OS doesn’t provide adequate disk management for database applications.
Winter Extensions Applications can extend OS servers to provide better match for its needs. Goal: build general purpose OS that provides extensibility+safety+performance. Example: UofWashington’s SPIN kernel.