9/2/2014 Operating Systems • Manage Resources • Abstract Details CS 1550: Introduction Jonathan Misurda jmisurda@cs.pitt.edu http://www.cs.pitt.edu/~jmisurda/ Manage Resources Abstract Details • CPU Time • Exclusive access to the CPU(s) • Memory • Huge amounts of dedicated RAM • I/O Devices • Exclusive access to I/O devices – Disks/Filesystems • Transparent security • Security In short, SHARING Varieties of OS Ye Olde Computer • Mainframe OS • Real-Time OS • Server OS – Hard real-time – Soft real-time • Parallel Computer OS • Embedded OS • Personal Computer OS • Smart Card OS 1
9/2/2014 Ye Olde Program Punchcard Data for $END program $RUN FORTRAN $LOAD program $FORTRAN $JOB, 10,6610802, ETHAN MILLER Why Study History? Multiprogramming Ontogeny Recapitulates Phylogeny Job 3 Development of the species is mimicked by the gestation of an individual Job 2 Or: Memory What’s old will be new again Job 1 partitions Operating system Image Protection Process’s Address Space 0x7fffffff Address Address Stack 0x2ffff 0x2ffff User program User data 0x2d000 and data Limit data 0x2b000 0x2bfff User data 0x29000 Base data 0x27fff Limit User program 0x24fff Limit text and data User program 0x23000 Base 0x23000 Base text 0x1dfff 0x1dfff Data (Heap) Operating Operating Data (Heap) system system 0 0 Text (Code) 0 2
9/2/2014 System Call Return to caller Context Switch Library Trap to kernel ( printf call) 3 Trap code in register Switching from one running process to User 8 space another 2 7 9 Increment SP 4 User Call printf code 1 Push arguments Kernel Sys call space Dispatch handler 5 6 (OS) A Simple Computer System Protect and Share • CPU time Outside – Preemption world • Memory – Address Spaces/Virtual Memory Video Hard drive USB Network • I/O controller controller controller controller – Spool • Simultaneous Peripheral Operation On Line • Security CPU Computer internals (inside the “box”) Memory CPU Architecture The Memory Hierarchy Execute unit Fetch Decode Better unit unit < 1 KB Registers 1 ns Execute Fetch Decode Execute Buffer unit 2 MB unit unit unit Cache (SRAM) 2–5 ns 512 MB Main memory (DRAM) 50 ns Fetch Decode Execute unit unit 250 GB Magnetic disk 5 ms unit > 1 TB Magnetic tape 50 sec Pipelined CPU Superscalar CPU 3
9/2/2014 Hard Drive Internals I/O Via Interrupts read/write head sector Return to caller Trap to kernel 3 2 3 Trap code in register 5 8 Interrupt Disk platter CPU controller controller 2 7 track 1 6 4 9 Increment SP 4 Call printf cylinder Push arguments 1 surfaces Sys call Dispatch handler 5 6 Hardware View Software View spindle actuator Hierarchical File System Monolithic OS Root directory Main cse procedure bin faculty grads Kernel mode Service ls ps cp csh routines elm sbrandt kag amer4 Utility classes research routines stuff stuff Microkernel Virtual Machines Client Client Process Terminal File Memory App 1 App 2 App 3 App 4 … User mode process process server server server server System calls Linux Windows NT FreeBSD I/O instructions Kernel mode Microkernel VMware VMware VMware Calls to simulate I/O Linux “Real” I/O instructions Bare hardware 4
Recommend
More recommend