COP 3402 meeting -*- Outline -*- * Operating System (OS) Overview Based on chapter 9 of Systems Software by Montagne and Operating Systems: Three Easy Pieces by Arpaci-Dusseau and Arpaci-Dusseau (see https://pages.cs.wisc.edu/~remzi/OSTEP/) ** What is an OS? ------------------------------------------ OPERATING SYSTEM Goal: The task of an operating system (OS) is to Other goals General approach: virtualization, i.e., abstraction of physical resources defines APIs for them = system calls ------------------------------------------ ... - make it easy to run programs. - provide a standard, convenient interface between programs and the computer's hardware. - manages sharing of the computer's resources (including: the CPU, memory, and devices: storage, printing, I/O, etc.) ... It should have minimal overhead (high performance) It should protect users and applications from each other It should be reliable (not crash) (and: It should be energy efficient, secure, mobile) Q: What kinds of I/O devices might you find on a computer? keyboard, mouse, screen, printer, touch pad or touch screen, microphone, loudspeakers, camera, network (wifi and/or ethernet), There can be others (tablet, VR headset) including those access through a USB port (Flash drives, ...) ** Some Early History Notes from chapter 2 of https://pages.cs.wisc.edu/~remzi/OSTEP/ ------------------------------------------ SOME HISTORY OF OPERATING SYSTEMS Early days: human operator ran jobs OS = libraries for I/O 1960s: protection via system calls imagine library that can read any part of a disk drive: Is any information safe then? System calls: hardware tracks privilege level users run in "user mode" OS runs in "kernel mode" call to system involves: a trap (user mode) -> trap handler starts kernel mode checks permissions return-from-trap instruction => back to user code (user mode) Multiprogramming (1970s, Unix): OS switches between tasks: - timesharing and interactivity - start of memory protection - issues of concurrency ------------------------------------------ Early computers were run in batch mode, didn't want humans wasting time "thinking" in front of a very expensive (at the time) computer... Q: How does user/kernel mode and the trap mechanism give protection? The OS can protect some resources (e.g., user identity records, permission lists), preventing users from writing them and only allowing a user with permission to do certain actions. Unix eventually found its way into Mac OS MS-DOS was a great leap backwards compared to Unix ** Organization of an OS *** monolithic Example: MS-DOS ------------------------------------------ WAYS TO ORGANIZE AN OS: MONOLITHIC No distinctions, boundaries between user and OS programs, all can directly use the BIOS drivers [Application Programs] | | | v v | [Systems progs] | | | | v | | [OS drivers] | | | | | v v v [BIOS device drivers] Advantages: Disadvantages: ------------------------------------------ Q: What is a BIOS? The built-in (or basic) I/O system ... + simple to implement + good performance ... - complex code, hard to maintain - crash of any part crashes entire OS *** layered Example: Unix/Linux ------------------------------------------ LAYERED OS Each layer can only use 1 layer below it [Application Programs] | v [Layer N: OS calls] | ... | v [Layer 1: OS kernel] | v [Layer 0: hardware] Advantages: Disadvantages ------------------------------------------ ... + easier to maintain, well-defined interface for each layer + easier to debug ... - designing layers is hard - passing data through layers can be slow *** micro-kernel Example: Mac OS ------------------------------------------ MICRO-KERNEL OS Layers, but with kernel as small as possible. Non-essential components become (user-space) apps [Application Programs] | v [Layer L: OS calls] | ... | v [Layer 1: micro-kernel] | v [Layer 0: hardware] Advantages: Disadvantages: ------------------------------------------ ... + OS becomes more portable (as micro-kernel is smaller) + better security and reliabilty (as micro-kernel very small) ... - more internal communication in the OS, so worse performance - design is harder, requires experience *** modular Example: Solaris OS ------------------------------------------ MODULAR OS Kernel has set of basic services, other services added as dynamic modules. Each module has defined API, but any module can call any other module ------------------------------------------