Download Operating Systems: Modules, Interfaces and Structure - Lecture 2 - Prof. Geoffrey M. Voelk and more Study notes Computer Science in PDF only on Docsity! 1 CSE 120 Principles of Operating Systems Fall 2004 Lecture 2: Operating System Modules and Interfaces Geoffrey M. Voelker September 23, 2002 CSE 120 – Lecture 2 – Modules and Interfaces 2 Modules, Interfaces, Structure We roughly defined an OS as the layer of software between hardware and applications Now we’re going to survey the support OSes provide to applications Modules – OS services and abstractions Interfaces – operations supported by components Structure – how components get hooked together » Will discuss in depth later in the quarter » Makes more sense after being exposed to much of the material This is all a high-level preview of what we are going to cover in the course 2 September 23, 2002 CSE 120 – Lecture 2 – Modules and Interfaces 3 OS Module Overview Common OS modules Processes Memory I/O Secondary storage Files Protection Accounting Command interpreter (shell, window system) We’ll survey each module and discuss its interface September 23, 2002 CSE 120 – Lecture 2 – Modules and Interfaces 4 Process Module An OS executes many kinds of activities User programs Batch jobs or command scripts System programs (daemons): print spoolers, name servers, file servers, Web servers, etc. Run “ps -edaf” on Solaris – What is all that stuff? Each “execution entity” is encapsulated in a process A process includes both the program (code, data) and execution context (PC, regs, address space, resources, etc.) Process module manages processes Creation, scheduling, deletion, etc. 5 September 23, 2002 CSE 120 – Lecture 2 – Modules and Interfaces 9 File System Secondary storage devices are too crude to use directly for long-term storage Read/write physical device blocks too low-level for programs The file system provides a much higher-level, more convenient abstraction for persistent storage Objects (files, directories) and interfaces (read, write, etc.) Files are the basic storage entity A file is a named collection of persistent information Directories are special files that contain the names of other files + metadata (data about files, attributes) Directories have all properties of files (“inheritance”) September 23, 2002 CSE 120 – Lecture 2 – Modules and Interfaces 10 File System Interface File system interface provides standard file operations Existence: File/directory creation, deletion Manipulation: open, read, write, append, rename, close, etc. Sometimes higher-level operations » File copy, change notification (NT) » Records (IBM) File system also provides general services Backup Consistency Compression Encryption Accounting and quotas 6 September 23, 2002 CSE 120 – Lecture 2 – Modules and Interfaces 11 Protection Protection is a general mechanism throughout OS All objects (resources) need protection Processes Memory Devices Files Protection mechanisms help to prevent errors as well as prevent malicious destruction E.g., running as root September 23, 2002 CSE 120 – Lecture 2 – Modules and Interfaces 12 Accounting General facility for keeping track of resource usage for all system objects Quotas in the file system (Unix: “quota –v”) Memory usage (Unix: “man limit”) Process resource usage (Unix: “rusage <command>”) Resource usage might be used to bill customers In world of PCs, might seem strange In world of mainframes and minicomputers, crucial » Departments, users billed for CPU time e.g., IBM mainframe “turbo” switch 7 September 23, 2002 CSE 120 – Lecture 2 – Modules and Interfaces 13 Command Interpreter (Shell) Process that: Handles user input (commands) Manages subprocesses Executes script files (files of commands) On some systems, CI is part of OS Users constrained to use that CI (DOS) Others, it is just another user-level process Unix shell Any program can be a CI (sh, csh, ksh, bash, etc.) Or, there may not be a command language at all Original MacOS (hey, where’s the shell?) What about MacOS 10? September 23, 2002 CSE 120 – Lecture 2 – Modules and Interfaces 14 The Challenge of Structure It is clear what modules an OS should provide Not so clear how to hook them together (well)… File System Process Management Memory Management I/O Subsystem Accounting Command Interpreter Secondary Storage Protection