Chapter 1: Introduction CSS503 Systems Programming Prof. Munehiro Fukuda Computing & Software Systems University of Washington Bothell CSS503 Chapter 1: Introduction
Defining Operating Systems Goals Execute user programs and make solving user problems easier Making the computer system convenient to use Using computer hardware in an efficient manner Definitions Resource allocator – manages and allocates resources Control program – controls the execution of user programs and operations of I/O devices Kernel – the one program running at all times (all else being application programs) CSS503 Chapter 1: Introduction
Computer System Components CSS503 Chapter 1: Introduction
Operating-System Operations Protection Distinguishing user and kernel I/O Management Asynchronous I/Os Process Management Launching, synchronizing, and terminating programs Memory Management Giving each task a independent logical address space Storage Management Giving logical views of disk spaces, (i.e. directories and files) CSS503 Chapter 1: Introduction
Chapter 1: Introduction Dual-Mode Operation User Mode: Non-privileged operations only Kernel Mode: All operations (including I/O instructions) Transition User to Kernel: Interrupts, system calls, and traps Kernel to User: A special instr. such as IRET CSS503 Chapter 1: Introduction
Chapter 1: Introduction I/O Management requesting process waiting device driver Interrupt handler Hardware data transfer user kernel time Faster CPU/Memory versus Slower I/Os Synchronous I/O or CPU I/O CPU takes care of All I/O operations. Polling wastes CPU time. CSS503 Chapter 1: Introduction
I/O Management (Cont’d) a requesting process replaced with another one device driver Interrupt handler Hardware data transfer user kernel time interrupts DMA Device interrupts and DMA Asynchronous I/O DMA takes care of I/O data transfers. Devices interrupt CPU when they are ready. CSS503 Chapter 1: Introduction
Chapter 1: Introduction Process Management Process Control Block and Logical Address A program in execution Process needs: CPU, memory, Files, I/Os etc. OS must supports: Creation: loading it in memory Synchronization/communication: having a process wait for another. Termination: clean it up from memory Process ID Text (Code + Global Data) UID GID EUID EGID Directory Entry TTY Heap Signal Dispatch Table Memory Map stdin priority 1 stdout Intr. mask 2 stderr registers 3 Stack CPU Status File Descriptors trek.txt CSS503 Chapter 1: Introduction
Chapter 1: Introduction Memory Management Process A’s Logical Address Physical Address Space Providing each process with a logical address space Mapping logical address to physical address (paging and segmentation) Facilitating virtual memory using disk Text Heap Process B’s Logical Address Text Heap Process C Text Stack Heap Stack Virtual Memory in Disk Stack CSS503 Chapter 1: Introduction
Chapter 1: Introduction Storage Management Process 1 1 2 3 stdin stdout stderr Disk partitioning Allowing multiple file systems File and directory management Logical to physical mapping File operations open, read, write, seek, close Boot sector, partition table Superblock 1 File descriptors File table entry inode Linux Process 2 1 2 3 stdin stdout stderr Superblock 2 File descriptors NTFS CSS503 Chapter 1: Introduction
Chapter 1: Introduction Memory Hierarchy Important Rules on Storage Operations Inclusion property Memory coherence Level Size Speed (ns) Managed by Registers 1KB 0.25 ~ 0.5 Compiler Cache 16MB 0.5 ~ 25 Hardware Main memory 16GB 80 ~ 250 OS Hard disks Several TB 5000 CPU Core 1 Core 2 Reg Reg L1 L1 L2 Cache Main Memory Hard disks Hard disks Hard disks CSS503 Chapter 1: Introduction
Chapter 1: Introduction Discussion Solve Text Exercises: 1.6 (Privileged Instructions) 1.8 (CPU Mode) 1.20 (DMA) 1.22 (Cache Memory) CSS503 Chapter 1: Introduction