chapter 2 operating system overview - · pdf fileserial processing • no operating ......

31
Chapter 2 Operating System Overview Seventh Edition By William Stallings Operating Systems: Internals and Design Principles

Upload: nguyendat

Post on 19-Mar-2018

236 views

Category:

Documents


3 download

TRANSCRIPT

Chapter 2Operating System

OverviewSeventh Edition

By William Stallings

Operating Systems:Internals

and Design

Principles

• A program that controls the execution of application programs

Operating System

Main objectives of an OS:

• Convenience• Efficiency• Ability to evolve

• Program development• Program execution• Access I/O devices• Controlled access to files• System access• Error detection and

response• Accounting

Operating System Services

• Phase 0 — hardware is a very expensive; no operating systems exist

One user at console• One function at a time (computation, I/O,user think/response)• Program loaded via card deck

– Libraries of device drivers (for I/O)

• User debugs at console

History

Serial ProcessingSerial Processing

• No operating system• programmers interacted

directly with the computer hardware

• Computers ran from a console with display lights, toggle switches, some form of input device, and a printer

• Users have access to the computer in “series”

• Scheduling:– most installations used a

hardcopy sign-up sheet to reserve computer time

– time allocations could run short or long, resulting in wasted computer time

• Setup time– considerable amount of

time was spent just on setting up the program to run

• Earliest Computers: • Problems:

Phase 1 — hardware is expensive , humans are cheapSimple batch processing: load program , run, print results,

dump, repeat

• User gives program (cards or tape) to the operator, who schedules the jobs

• Resident monitor automatically loads, runs, dumps user jobs

• Requires memory management (relocation) and protection

• More efficient use of hardware, but debugging is more difficult (from dumps)

History

Phase 1 — hardware is expensive , humans are cheapOverlapped CPU & I/O operations• First: buffer slow I/O onto fast tape drives connected to

CPU, replicate I/O devices• Later: spool data to disk

History

•bring cards to 1401•read cards to tape offline•put tape on 7094 which does computing•put tape on 1401 which prints output offline

Phase 1 — hardware is expensive , humans are cheapMultiprogrammed batch systemsMultiple jobs are on the disk, waiting to runMultiprogramming — run several programs at the “same”

time– Pick some jobs to run (scheduling), and put them in

memory (memory management)– Run one job; when it waits on something(tape to be mounted, key to be pressed),switch to another job in memory

History

Multiprogrammed Batch Systems

• Several jobs from the pool of all submitted jobs are kept in main memory at the same time, and the CPU is multiplexed among them.

Monitor has

1. Device Drivers

2. Interrupt Routines

3. Job Sequencing

Phase 2 — hardware is less expensive than before, humans are expensive

Interactive timesharing• Lots of cheap terminals, one computer

– All users interact with system at once– Debugging is much easier

• Disks are cheap, so put programs and data online– 1 punch card = 100 bytes– 1MB = 10K cards– OS/360 was several feet of cards

History

Phase 2 — hardware is less expensive than before, humans are expensive

Interactive timesharingNew problems:

– Need preemptive scheduling to maintain adequate response time

– Need to avoid thrashing (swapping programs in and out of memory too often)

– Need to provide adequate security measuresSuccess: UNIX developed at Bell Labs so a couple of computer nerds

(Thompson, Ritchie) could play Star Trek on an unused PDP-7 minicomputer

History

Phase 3 — hardware is very cheap, humans are expensivePersonal computing• CPUs are cheap enough to put one in each terminal, yet

powerful enough to be useful– Computers for the masses!

• Return to simplicity; make OS simpler by getting rid of support for multiprogramming, concurrency, and protection

History

OS Features Needed for Multiprogramming

Why multiprogramming?üIncreases CPU utilization by trying to always

keep the CPU busy processing some jobüI/O of one job causes switch to another job

•Memory management – the system must allocatethe memory to several jobs.

•CPU scheduling – the system must choose amongseveral jobs ready to run.

•Allocation of devices.

Parallel Systems

• Multiprocessor systems with more than on CPU in close communication.

• Tightly coupled system – processors share memory and a clock; communication usually takes place through the shared memory.

• Advantages of parallel system: – Increased throughput with more processors– Economical – share peripherals, mass storage, power etc. as

opposed to individual PCs– Increased reliability

• graceful degradation / fault tolerant– failure of one processor will slow down but not halt the system– other processors pick up the slack

Parallel Systems (Cont.)• Symmetric multiprocessing

(SMP)– Each processor runs and

identical copy of the operating system.

– Many processes can run at once without performance deterioration.

– Most modern operating systems support SMP

Asymmetric multiprocessingl Each processor is assigned a specific task; controlling processor schedules

and allocates work to other processors.l More common in extremely large systems

• Distribute the computation among several physical processors.• Loosely coupled system – each processor has its own local

memory; processors communicate with one another through various communications lines, such as high-speed buses or telephone lines.

• Advantages of distributed systems.– Resource sharing – Computation speed up – load sharing – Reliability– Communications between processors and processes

Distributed Systems

• Often used as a control device in a dedicated application such as controlling scientific experiments, medical imaging systems, industrial control systems, and some display systems.

• Well-defined, fixed time constraints.• Hard real-time:

– Secondary storage limited or absent, data stored in short term memory, or read-only memory (ROM)

– Not supported by general-purpose operating systems.

• Soft real-time– Limited utility in industrial control of robotics– Useful in applications (multimedia, virtual reality) requiring advanced

operating-system features.

Real-Time Systems

Handheld Systems• Personal Digital Assistants (PDAs)• Cellular telephones• Issues:

– Limited memory (512KB to 8MB) requires efficient management

– Slow processors– Small display screens.

Kernel-Mode Components of Windows

Executivecontains the core OS services

Kernelcontrols execution of the processors

Hardware Abstraction Layer (HAL)maps between generic hardware commands and responses and those unique to a specific platform

Device Driversdynamic libraries that extend the functionality of the Executive

Windowing and Graphics Systemimplements the GUI functions

Microsoft Windows OverviewMicrosoft Windows OverviewMicrosoft Windows OverviewMicrosoft Windows Overviewn MS-DOS 1.0 released in 1981n 4000 lines of assembly language

source coden ran in 8 Kbytes of memoryn used Intel 8086 microprocessor

n Windows 3.0 shipped in 1990n 16-bitn GUI interfacen implemented as a layer on top of

MS-DOS

n Windows 95n 32-bit versionn led to the development of Windows

98 and Windows Me

n Windows NT (3.1) released in 1993n 32-bit OS with the ability to support

older DOS and Windows applications as well as provide OS/2 support

n Windows 2000n included services and functions to

support distributed processingn Active Directoryn plug-and-play and power-

management facilities

n Windows XP released in 2001n goal was to replace the versions of

Windows based on MS-DOS with an OS based on NT

n Windows Vista shipped in 2007

n Windows Server released in 2008

n Windows 7 shipped in 2009, as well as Windows Server 2008 R2

n Windows Azuren targets cloud computing

• Were developed at Bell Labs and became operational on a PDP-7 in 1970• Incorporated many ideas from Multics• PDP-11was a milestone because it first showed that UNIX would be an OS for all

computers• Next milestone was rewriting UNIX in the programming language C

• demonstrated the advantages of using a high-level language for system code

• Was described in a technical journal for the first time in 1974

• First widely available version outside Bell Labs was Version 6 in 1976

• Version 7, released in 1978 is the ancestor of most modern UNIX systems

• Most important of the non-AT&T systems was UNIX BSD (Berkeley Software Distribution)

Traditional UNIX SystemsTraditional UNIX Systems

Traditional UNIX SystemsTraditional UNIX Systems

Linux SystemsLinux Systems• Started out as a UNIX variant for the IBM PC• Linus Torvalds, a Finnish student of computer science, wrote the initial

version• Linux was first posted on the Internet in 1991• Today it is a full-featured UNIX system that runs on several platforms• Is free and the source code is available• Key to success has been the availability of free software packages • Highly modular and easily configured

SummaryOperating system objectives and functions:

convenience, efficiency, ability to evolveuser/computer interfaceresource manager

Evolution:

serial processing,

simple batch systems, multiprogrammed batch systems,

time sharing systems

OS Architecture

Layered, Monolithic