6c67571262363be162d997f93f5acd35.ppt
- Количество слайдов: 41
Slide 1 -1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
Slide 1 -2 Introduction Copyright © 2004 Pearson Education, Inc. 1 Operating Systems: A Modern Perspective, Chapter 1
Why Study Operating Systems? • Understand the model of operation – Easier to see how to use the system – Enables you to write efficient code • Learn to design an OS • Even so, OS is pure overhead of real work • Application programs have the real value to person who buys the computer Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -3
Slide 1 -4 What is an Operating System? • A program or collection of programs that act as intermediary between the user of a computer and the computer hardware. • Operating system goals: – Make the computer convenient to use. – Use computer resources in an efficient manner. – Coordinate among the various users and programs that are competing for computing resources. Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
Perspectives of the Computer print cut save send open() malloc() fork() read-disk start-printer track-mouse Application Software System Software Hardware (b) Application Programmer View (c) OS Programmer View (a) End User (b) View Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -5
Slide 1 -6 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
Slide 1 -7 Operating System Definition • OS provides an interface between the computer hardware and users, applications and system software. • OS manages computer resources. • OS controls and coordinates the use of the computing resources among the various users/programs: – resource sharing among computer users/programs – protect users from each others Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
System Software • Independent of individual applications, but common to all of them • Examples –C library functions –A window system –A database management system –Resource management functions –The OS Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -8
Using the System Software Application Programmer System Software API Command Line Interpreter Compiler Loader Libraries Database Management System Window System OS Hardware Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -9
Application Software, System Software, and the OS Human-Computer Interface Application Software API System Software (More Abstract Resources) OS Interface Trusted OS (Abstract Resources) Software-Hardware Interface Hardware Resources Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -10
The OS as Resource Manager • Process: An executing program • Resource: Anything that is needed for a process to run –Memory –Space on a disk –The CPU • “An OS creates resource abstractions” • “An OS manages resource sharing” Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -11
Resource Abstraction Slide 1 -12 load(block, length, device); seek(device, 236); out(device, 9) write(char *block, int len, int device, int track, int sector) {. . . load(block, length, device); seek(device, 236); out(device, 9); . . . } write(char *block, int len, int device, int addr); fprintf(file. ID, “%d”, datum); Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
Disk Abstractions Slide 1 -13 Application Programmer OS Programmer void write() { load(…); seek(…) out(…) } load(…); seek(…); out(…); (a) Direct Control Copyright © 2004 Pearson Education, Inc. (b) write() abstraction Operating Systems: A Modern Perspective, Chapter 1 int fprintf(…) {. . . write(…) … } (c) fprintf() abstraction
Abstract Resources User Interface Application Abstract Resources (API) Middleware OS Resources (OS Interface) OS Hardware Resources Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -14
Abstract Machines Slide 1 -15 Abstract Machines Idea Program Physical Machine Result Idea Program Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 … Result … Idea … Program Result
Resource Sharing • Space- vs time-multiplexed sharing • To control sharing, must be able to isolate resources • OS usually provides mechanism to isolate, then selectively allows sharing – How to isolate resources – How to be sure that sharing is acceptable • Concurrency Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -16
The OS as a Conductor The OS coordinates the sharing and use of all the components in the computer Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -17
Multiprogramming Abstract Machine Pi Abstract Machine Pj Abstract Machine Pk … OS Resource Sharing Pi Memory Pk Memory … Time-multiplexed Physical Processor Pj Memory Space-multiplexed Physical Memory Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -18
Slide 1 -19 Multiprogramming(2) • Technique for sharing the CPU among runnable processes – Process may be blocked on I/O – Process may be blocked waiting for other resource, including the CPU • While one process is blocked, another might be able to run • Multiprogramming OS accomplishes CPU sharing “automatically” – scheduling • Reduces time to run all processes Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
How Multiprogramming Works Process 1 Process 2 Process 3 Time-multiplexed CPU Process 4 Space-multiplexed Memory Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -20
Speeding Up the Car Wash Vacuum Inside Wash (a) The Sequential Car Wash Vacuum Inside Wash Dry (b) The Parallel Car Wash Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -21 Dry
Slide 1 -22 Multiprogramming Performance Pi’s Total Execution Time, ti 0 ti Time (a) Pi’s Use of Machine Resources P 1 P 2 Pi … … PN Time (a) All Processes’ Use of Machine Resources Using the processor I/O operation Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
OS Strategies • • Batch processing Timesharing Personal computer & workstations Process control & real-time Network Distributed Small computers Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -23
Slide 1 -24 Batch Processing Job 3 Job 19 Input Spooler Output Spool Input Spool Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
Batch Processing(2) • • Slide 1 -25 Uses multiprogramming Job (file of OS commands) prepared offline Batch of jobs given to OS at one time OS processes jobs one-after-the-other No human-computer interaction OS optimizes resource utilization Batch processing (as an option) still used today Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
A Shell Script Batch File Slide 1 -26 cc -g -c menu. c cc -g -o driver. c menu. o driver < test_data > test_out lpr -Pthe. Printer test_out tar cvf driver_test. tar menu. c driver. c test_data test_out uuencode driver_test. tar >driver_test. encode Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
Timesharing Systems Abstract Machines Result Physical Machine Command Result … Command Result Command Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -27
Timesharing Systems(2) Slide 1 -28 • Uses multiprogramming • Support interactive computing model (Illusion of multiple consoles) • Different scheduling & memory allocation strategies than batch • Tends to propagate processes • Considerable attention to resource isolation (security & protection) • Tend to optimize response time Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
Personal Computers • CPU sharing among one person’s processes • Power of computing for personal tasks – Graphics – Multimedia • Trend toward very small OS • OS focus on resource abstraction • Rapidly evolved to “personal multitasking” systems Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -29
Slide 1 -30 Process Control & Real-Time • Computer is dedicated to a single purpose • Classic embedded system • Must respond to external stimuli in fixed time • Continuous media popularizing real-time techniques • An area of growing interest Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
Slide 1 -31 Networks • LAN (Local Area Network) evolution • 3 Mbps (1975) 10 Mbps (1980) 100 Mbps (1990) 1 Gbps (2000) • High speed communication means new way to do computing – – Shared files Shared memory Shared procedures/objects ? ? ? Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
Slide 1 -32 Distributed OS • Wave of the future App App App Distributed OS Multiple Computers connected by a Network Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
Distributed Systems • Distribute the computation among several physical processors. • Multiprocessor system: Tightly coupled systems – processors share memory and a clock; communication usually takes place through the shared memory. • Loosely coupled systems – each processor has its own local memory; processors communicate with one another through various communication lines • Advantages of distributed systems: – Resource sharing, Computation speed up – Reliability, Communication Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -33
Small Computers • PDAs, STBs, embedded systems became commercially significant • Have an OS, but – Not general purpose – Limited hardware resources – Different kinds of devices • Touch screen, no keyboard • Graffiti – Evolving & leading to new class of Oses • Palm. OS, Pocket PC (Win. CE), Vx. Works, … Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -35
Slide 1 -36 Evolution of Modern OS Timesharing Memory Mgmt Scheduling Batch Protection Memory Mgmt Protection Scheduling Files Devices Network OS PC & Wkstation Protocols System software Real-Time Human-Computer Interface Scheduling Small Computer Modern OS Copyright © 2004 Pearson Education, Inc. Client-Server Model Network storage, Resource management Operating Systems: A Modern Perspective, Chapter 1
Slide 1 -37 Examples of Modern OS • UNIX variants (e. g. Linux) -- have evolved since 1970 • Windows NT/2 K -- has evolved since 1989 (much more modern than UNIX – Win 2 K = Win. NT, V 5 • • Research OSes – still evolving … Small computer OSes – still evolving … Book provides Linux examples This course will use Windows NT as the main example Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
The Microsoft OS Family Win 32 API Subset Win 32 API Sub. Set Windows CE (Pocket PC) Windows 95/98/Me Windows NT/2000/XP Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -38
Microsoft Windows NT • Heavily window-oriented • Foundation behavior is windowsindependent – We will focus on the foundation – Use only the “MS-DOS prompt” -- cmd. exe OS API NT Executive NT Kernel Copyright © 2004 Pearson Education, Inc. NT User Interface and Graphics Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -39
Slide 1 -40 Windows NT (cont) • • • OS API has text orientation (like UNIX) Object-oriented implementation Heavy use of threads Broad spectrum of synchronization tools Modern I/O system Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1
Vx. Works Organization Applications Vx. Works Runtime System Vx. Works Configurable Core OS Extension Wind Microkernel Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -41
Windows CE Organization Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 1 Slide 1 -42