10/11 Operating Systems - The job of the O/S is to fix the device model. Hardware rarely supports virtualization, sharing, protection, portability, high-level functions. VM: sort of (what about allocation?). Disk: no. Net: no. - Programmers expect an API to program against - programming the hardware (interface cards, raw disk, interrupts, etc.) directly is difficult and the resulting code is not portable, because hardware API changes. - What's an abstraction? TLB entries vs address spaces. Phys mem vs address space. Disk blocks vs file systems. Frame buffer vs windows. Ethernet frames vs TCP/IP. IPC vs direct sharing. ??? vs file descriptors. - Abstraction that programmers want: - A named file abstractions - file is linear array of bytes open, read, write, close, seek - naming: directories and symbolic names opendir, readdir, ln, etc. - abstract disks mount, umount - abstract networks NFS3 - A process abstraction - process fork, exec, exit, getpid, wait - scheduling nice - signals (software variants of hardware events) kill, psignal, sigprocmask, sigsuspend, etc. - process groups & sessions for job control - debugging ptrace - Address spaces - VM pin, map, unmap, mprotect, shmat, etc. - Growing malloc - Paging pageout daemon - Swapping swap daemon - IPC - Sockets - Networking - File descriptor passing - I/O - character device raw, physical - block device - file descriptors open, close, read, write, dup, stop - asychronous/synchronous select - locking - Terminals - Window manager - Timers - Authentication uid, setuid, etc. - Access control ACLs - Resource control Quota - ... - Next week we will figure out what abstractions a programmer may want for a cluster of computers. [plan 9] - Why would you want abstractions? More convenient (but why not in a library?). Enforces compatibility and sharing (files, TCP). Helps w/ composable, re-usable, general-purpose applications. Helps make applications portable. Mediate/protect shared resources. This is the only deep reason! - Which program should implement these abstractions? - The application? No, it cannot enforce protection - In the kernel? Yes, it can enforce protection, since it controls hardware priviledge levels, etc. - Why would you want to get rid of abstractions? Reduce size of TCB. Virtualization hides information. Prevents precise control. Prevents alternate abstractions.