460 likes | 472 Views
Operating System Overview. Today’s Objectives. Explain the main purpose of operating systems and describe milestones of OS evolution Explain fundamental machine concepts such as: Instruction processing, Memory hierarchy, Interrupts, and I/O Explain fundamental OS concepts such as:
E N D
Today’s Objectives • Explain the main purpose of operating systems and describe milestones of OS evolution • Explain fundamental machine concepts such as: • Instruction processing, • Memory hierarchy, • Interrupts, and • I/O • Explain fundamental OS concepts such as: • System calls, • processes, • synchronization, • Files • Explain the POSIX standard (UNIX specification)
Today’s Applications Application Software Browser Second Life Yahoo Chat Client Pop Mail Hardware Network
Application Requirements Application Software Browser Second Life Yahoo Chat Client Pop Mail Store Read/write Display Print Send/receive Hardware Network
Application Requirements Application Software Browser Second Life Yahoo Chat Client Pop Mail Store Display Read/write Print Store Read/write Display Print Send/receive Send/receive Hardware Network
Application Requirements Application Software Browser Second Life Yahoo Chat Client Pop Mail Store Print Display Read/write Store Print Send/receive Store Display Read/write Print Display Send/receive Send/receive Read/write Hardware Network
Application Requirements Application Software Browser Second Life Yahoo Chat Client Pop Mail Store Print Read/write Store Display Store Print Send/receive Store Send/receive Display Read/write Print Display Send/receive Send/receive Display Read/write Read/write Print Hardware Network
Delegate Common Functions? Application Software Browser Second Life Yahoo Chat Client Pop Mail Store Print Read/write Store Display Store Print Send/receive Store Send/receive Display Read/write Print Display Send/receive Send/receive Display Read/write Read/write Print Hardware Network
Delegate Common Functions to an Operating System Application Software Web Server Second Life Yahoo Chat Pop Mail Operating System Read/Write Standard Output Device Control File System Communication Hardware Network
OS Exports a Virtual Machine Interface Application Software Web Server Second Life Yahoo Chat Pop Mail Standard Operating System Interface (Virtual Machine) Operating System Read/Write Standard Output Device Control File System Communication Hardware Network
Increase Portability = Minimize Machine-Specific Code Application Software Web Server Second Life Yahoo Chat Pop Mail Standard Operating System Interface (Virtual Machine) Operating System (machine independent part) Read/Write Standard Output Device Control File System Communication Machine specific part Network Hardware
Increase Portability = Minimize Machine-Specific Code Application Software Web Server Second Life Yahoo Chat Pop Mail Standard Operating System Interface (Virtual Machine) Operating System (machine independent part) Portable Read/Write Standard Output Device Control File System Communication Machine specific part Network Hardware
OS Runs on Multiple Platforms while Presenting same Interface Application Software Web Server Second Life Yahoo Chat Pop Mail Standard Operating System Interface (Virtual Machine) Operating System (machine independent part) Portable Read/Write Standard Output Device Control File System Communication
OS Runs on Multiple Platforms while Presenting same Interface Application Software Web Server Second Life Yahoo Chat Pop Mail Standard Operating System Interface (Virtual Machine) Operating System (machine independent part) Portable Read/Write Standard Output Device Control File System Communication Machine specific part Network Hardware
POSIX – The UNIX Interface Standard Application Software Web Server Second Life Yahoo Chat Pop Mail The POSIX Standard Specifies UNIX Interface Operating System (machine independent part) Portable Read/Write Standard Output Device Control File System Communication Machine specific part Network Hardware
A peek into Unix Application Libraries User space/level Kernel space/level Portable OS Layer Machine-dependent layer • User/kernel modes are supported by hardware • Some systems do not have clear user-kernel boundary
Unix: Application Application (E.g., emacs) • Written by programmer • Compiled by programmer • Uses function calls Libraries Portable OS Layer Machine-dependent layer
Unix: Libraries Application • Provided pre-compiled • Defined in headers • Input to linker (compiler) • Invoked like functions • May be “resolved” when program is loaded Libraries (e.g., stdio.h) Portable OS Layer Machine-dependent layer
Typical Unix OS Structure Application Libraries Portable OS Layer Machine-dependent layer • system calls (read, open..) • All “high-level” code
Typical Unix OS Structure Application • Bootstrap • System initialization • Interrupt and exception • I/O device driver • Memory management • Kernel/user mode switching • Processor management Libraries Portable OS Layer Machine-dependent layer
Summary:What is an Operating System? • It is an extended machine • Hides the messy details which must be performed • Presents user with a virtual machine, easier to use • It is a resource manager • Each program gets time with the resource • Each program gets space on the resource
History of Operating Systems Early systems • bring cards to 1401 • read cards to tape • put tape on 7094 which does computing • put tape on 1401 which prints output Batch Multiprogramming Time sharing Personal
History of Operating Systems • Structure of a typical job – 2nd generation
History of Operating Systems • Multiprogramming/timesharing system • three jobs in memory – 3rd generation
History of Operating Systems • Multiprogramming/timesharing system • three jobs in memory – 3rd generation Memory Management Process Management
History of Computer Generations • First generation 1945 – 1955 • vacuum tubes, plug boards • Second generation 1955 - 1965 • transistors, batch systems • Third generation 1965 – 1980 • ICs and multiprogramming • Fourth generation 1980 – present • personal computers
Computer Hardware Review Components of a simple personal computer Bus
Computer Hardware Review Components of a simple personal computer CPU Bus
CPU • Fetch instruction from code memory • Fetch operands from data memory • Perform operation (and store result) • Go to next instruction
CPU Registers • Fetch instruction from code memory • Fetch operands from data memory • Perform operation (and store result) • Go to next instruction • Note: CPU must maintain certain state • Current instructions to fetch (program counter) • Location of code memory segment • Location of data memory segment
CPU Register Examples • Hold instruction operands • Point to start of • Code segment • Data segment • Stack segment • Point to current position of • Instruction pointer • Stack pointer
CPU Register Examples • Hold instruction operands • Point to start of • Code segment • Data segment • Stack segment • Point to current position of • Instruction pointer • Stack pointer • Why stack?
Code Layout for Process • Processes have three segments: text, data, stack
Code Layout for Process • Processes have three segments: text, data, stack Where is this stored?
Memory Hierarchy • Typical memory hierarchy • numbers shown are rough approximations
Computer Hardware Review Components of a simple personal computer CPU Bus
Computer Hardware Review Components of a simple personal computer CPU Memory Bus
Computer Hardware Review Components of a simple personal computer CPU Memory I/O Devices Bus
I/O Interrupt Mechanism • Steps in starting an I/O device and getting interrupt • How the CPU is interrupted (a) (b)
Computer Hardware ReviewExample I/O Device: Disk Structure of a disk drive
Operating System Review:Processes • A process tree • A created two child processes, B and C • B created three child processes, D, E, and F
Context Switching • How would you switch CPU execution from one process to another?
Semaphores • Control access to resources
Shared Resources, Conflicts, and Deadlocks (a) A potential deadlock. (b) an actual deadlock.
Inter-process Communication Two processes connected by a pipe