9c30911f220e6a0be50b21d86d0aff38.ppt
- Количество слайдов: 12
Today’s topics Virtual Environment for Computing Operating Systems Upcoming Program Execution Times (Great Ideas, Chapter 13) Reading Great Ideas, Chapter 10 CPS 001 34. 1
The Problem v The Raw Machine Provides a Hostile Environment q Imagine program in machine language. Machine Language Program for MIPS Machine [00400000] [00400004] argv [00400008] envp [0040000 c] [00400010] [00400014] [00400018] [0040001 c] v 8 fa 40000 lw $4, 0($29) 27 a 50004 addiu $5, $29, 4 ; lw $a 0, 0($sp) ; addiu $a 1, $sp, 4 # 24 a 60004 addiu $6, $5, 4 ; addiu $a 2, $a 1, 4 # 00041080 00 c 23021 0 c 000000 3402000 a 0000000 c sll $2, $4, 2 ; addu $6, $2 ; jal 0 x 00400020 [main]; ori $2, $0, 10 ; syscall ; sll $v 0, $a 0, 2 addu $a 2, $v 0 jal main li $v 0 10 syscall Imagine doing disk I/O directly: q q CPS 001 disk description controlling Heads; timing keeping track of where things are stored dealing with Errors 34. 2
The Problem v Other I/O q q q v Keeping track of memory (RAM) q q v Multiple tasks Multiple users Sharing the CPU q q v Keyboard Screen Communications Multiple tasks Multiple users The User Interface Problem q q q For the computer professional only? For the lay person The Graphical User Interface o Computation to support this? CPS 001 34. 3
Historical Perspective v Early Years q q q v Early 1960's machines: Almost Bare Mid 1960's Machines: Early Batch Operating Systems Multiprogramming Systems Time Sharing Lab Computers Had Major Theme: CPU Time Precious q q q CPS 001 Ease of use: very low priority Graphical User Interface too costly (and not yet invented) This perspective faded with time and began to disappear with advent of the microprocessor: Cheap CPU time. 34. 4
Historical Perspective v Later Years q q v Microprocessor in late 70’s PC's in early 80’s: Operating Systems for PC Apple: Macintosh (Xerox PARC) Workstations o UNIX -- AT&T: License Wars -- LINUX Major Change: Lower Costs q q Whole new audience User Interface o Essential for non pros o Affordable (cpu cycles to burn) q q CPS 001 Whole new competitive environment Volume! 34. 5
Role of the Operating System 1. Processor Management (Multiprogramming) 1. 2. I/O Systems 1. 2. 3. Windowing Systems / GUIs File Systems (use of your hard disk) Communications/Networking Memory (RAM) Management 1. 2. 4. Several virtual machines Sharing Memory Simulating Additional Memory (Virtual Memory) Software Environments q q q CPS 001 Administration/Accounting Compilers Tools 34. 6
Memory Management v Virtual Memory q v Cache Memory q q v Slow and fast memory Library, bookcase, desktop analogies Memory Hierarchies q q v Simulate memory using disks Registers x 1 Cache x 10 - x 100 Main Memory x 100 - x 1000 Disks x 1, 000 Overhead q q CPS 001 Card Catalog analogies Finding stuff on your desk or bookcase 34. 7
Memory Management. 2 v Historically q q v Swapping in Time Sharing Systems Whole user image involved Paging q Page is conveniently sized block of memory (RAM) o (power of 2) q v Physical swapping done page at a time Protection q q q CPS 001 Security (write protect) Confidentiality (read protect) (Early machines) 34. 8
I/O Systems v Communications/Networking q q v Graphical User Interfaces (GUI) q q v Extremely important in modern systems (Dealt with that before) X-Windows Macintosh Desktop MS Windows Xerox PARC; Legal Fun Files Systems q q q CPS 001 Flat Hierarchical (Directories) Distributed Files Systems o Andrew File System (AFS) o Network File System (NFS) 34. 9
Processor Management v Virtual Machines q q v Process Management q q v True Parallel Processes vs. Simulated o Note that the “interleaving” is unpredictable Interrupts o Contrast with “busy waiting” Fairness Responsiveness Synchronization Problems q Danger of shared resources o Data: Race conditions o Any Exclusive Resource: Deadlock CPS 001 34. 10
Synchronization Problems v Race Conditions q q Two Processes (A and B) A manages (updates, etc. ) “clock” B uses “clock” Example: clock at 8: 59 A: add one to minutes – 8: 00 – note carry! B: reads clock 8: 00! q v v A: add carry to hours 9: 00 Due to bad timing, B gets a time almost 1 hour off ! How can we avoid Race Conditions? Deadlocks q User A needs printer P and modem M q User B needs modem M and printer P q Both are competing for same resources q 3 scenarios possible CPS 001 34. 11
Synchronization Problems Scenario 1 Scenario 2 Scenario 3 A: get P A: get M B: get M (wait!) A: process A: release M, P B: get M B: get P B: process B: get M B: get P A: get P (wait!) B: process B: release P, M A: get P A: get M A: process A: get P B: get M A: get M (wait!) B: get P (wait!) …keep waiting… …forever… DEADLOCK! v How can we avoid Deadlocks? CPS 001 34. 12


