Operating System Foundations Lecture #2
Operating System Functions Processor Hard- disk Memory Frame -buffer Sound -card Printer Mouse Application
Operating System Functions Processor Hard- disk Memory Frame -buffer Sound -card Printer Mouse Application Operating System
OS Functions OS as layer of protection Process 1 Process 2 Process 3 Protect Memory I/O
OS Protection Don’t let any single application hog the processor Only the OS manages the clock Set timers Kick out a process when the time expires Take control of the processor every so often when there are system-wide things to do (I/O, memory management, scheduling).
OS Protection Privileged Instructions Only access via a “privilege mode” Make a distinction between User and “supervisor” mode Only supervisor mode can mask interupts Only supervisor mode can access memory management structures Only supervisor mode can do I/O
Operating Systems Functions OS as Abstraction Layer System Call Interface Systems Calls For interacting with Hardware and other processes open(file, read_rights) read (file_id, block_number) alarm(up_call, seconds) send_message(socket_id, message)
Scheduling Processor ALU Main Memory Application Operating System Scheduler
Scheduling Process number Current state Program Counter CPU Registers Memory Mapping Misc Info (open files, name of executable, devices owned) Next and prev PCB
Context Switching Process A Process BOS Save state A Restore state B Save state B Restore state A
Memory Management Process 1 Process 2 Process 3 0x0000 0x00F0 0x00FF 0x0FFF Process1 From To 0x0dfff 0xfdfff Process2 ………… Process3
Memory Management An alternative way and intuitively easier to understand Process 1: Memory Segment 1,2 Process 2: Segment 3 Process 3: Memory segment 7,8,9 Every memory access is checked in hardware to verify that you are only accessing your own memory segment OS provides IPC!
I/O Operating System as a multiplexer of I/O devices Protect Resources, yet let processes share them Privilege Mode User Mode System Calls, Interrupts Set User mode (privilges Instruction)
I/O Open(device, rights) Privileged Instruction Process -- > Open Devices Table