3 - introduction to operating systemsnrg.cs.ucl.ac.uk/mjh/3005/2009/3-os-intro.pdf3 - introduction...

14
1 3 - Introduction to Operating Systems Mark Handley What is an Operating System? An OS is a program that: manages the computer hardware. provides the basis on which application programs can be built and run. acts as an intermediary between the user and the hardware.

Upload: dangngoc

Post on 05-Apr-2018

223 views

Category:

Documents


2 download

TRANSCRIPT

1

3 - Introduction toOperating Systems

Mark Handley

What is an Operating System?

An OS is a program that:manages the computer hardware.provides the basis on which application programs

can be built and run.acts as an intermediary between the user and the

hardware.

2

What operating systems have you used?

Unix (4.3BSD, SunOS, Ultrix, HPUX, Solaris, OSF1,FreeBSD, Linux, MacOS X)

DOS (MSDOS, Windows 3.1, 95, 98, ME) NT (NT 3.51, Windows 2000, Windows XP, Vista) MacOS (7, 9) Vax VMS GEC OS4000 CP/M PDA: PalmOS, Psion 3, Psion EPOC, Linux, Blackberry Routers: Cisco IOS, Juniper JunOS, Procket, XOS Embedded: car, phone, digital camera, iPod, DSL router,

WiFi AP.

Goals

Optimize use of hardware Convenient for user Efficient Robust Secure

Different systems have different goals. Efficiency matters on a PDA, phone, or Mars rover. Convenience matters on a PC. Hardware optimization is important on mainframes.

OS design is all about tradeoffs.

3

Typical System Components

User 1 User 4User 2 User 3 User 5

Computer Hardware

System and Application Programs

Operating System

Compiler Database

What is in an OS?

Bill Gates claimed that Internet Explorer is part ofthe Windows Operating System. Is he right?

Tannenbaum claims that the Operating System isonly what resides in the kernel. Everything else is anapplication. Is he right?

4

Types of System

Mainframe Systems Desktop Systems Multiprocessor Systems Distributed Systems Clustered Systems Real-Time Systems Handheld Systems

Early Computers

ENIAC, 1946

5

Punched Card Reader

Mainframe Systems (1): Batch Systems

Early computers were huge,expensive and slow.

Card readers or paper tape for input.Leave program with the operator,get back printout next day.

Role of OS is to load a job, run it,load the next job, run it, etc.

Not very efficient, as job takes along time to load.

UserProgramMemory

OperatingSystem

Typical MemoryLayout

6

IBM 360Operator Panel

Mainframe Systems (2): Multiprogramming

Maintain a job pool on disk. Keep a subset of jobs in memory. When one job stalls waiting for I/O,

switch to a different one. OS Functions:

Job SchedulingDisk I/OMemory Management

OperatingSystem

Job 1

Job 3

Job 4

Typical MemoryLayout

Job 2

7

Mainframe Systems (3): Time Sharing

Time-sharing (or Multitasking) is a logical extension ofmultiprogramming.

CPU switches between jobs so quickly that users can interactwith a program while it is running. Requires good responsiveness. When a job stalls waiting for I/O, another job can be run,

giving good CPU utilization. The job pool is now under the control of the users.

But memory is limited, so this requires swapping some jobsout to disk. One solution is virtual memory, where a jobthat is only partly in memory can be run.

Also requires a filesystem for users to store the data from theirjobs, and to abstract the details of the disk hardware.

DEC PDP 11/44, IBM PC

8

Desktop Systems (1)

Early desktop systems had little memory, and nomemory management hardware.CP/M, MS-DOS, MacOSOne user. One primary user task at a time.Goals were user convenience and responsiveness.

As later hardware gained capability, so too did theoperating systems.Gained functionality first designed for

mainframes.

Desktop Systems (2)

Unix moved to the workstation, and later to the PC. BSD Unix, SunOS, and later on, FreeBSD and Linux.

Windows NT appeared, with true multitasking and memorymanagement support.

MacOS X - Mach/FreeBSD Unix derived.

Some goals have changed: No longer need to maximize CPU utilization.

Some have not: File protection and user isolation, needed on multitasking

mainframes to separate users, are now needed for virusisolation on networked PCs with only a single user.

9

Multiprocessor Systems (1)

For really big systems, the fastest CPU is never fast enough. Only solution: use many CPUs.

One box with many CPUs, or many boxes with one CPU? Multiprocessor can be cheaper (shared peripherals), and

faster (low communications cost), and simpler (shareddata), but it isn’t always.

Depends on task.

On the desktop, CPUs are now cheap enough to havemultiprocessor PCs. Really good for a crisp responsive user interface. Quad-core CPUs already commonplace; eight cores soon.

Multiprocessor Systems (2): OS style

Symmetric multiprocessing (SMP) All CPUs are equal; each runs kernel tasks, and

communicate with each other as needed. Eg Solaris, Linux 2.6, FreeBSD 6, Windows NT, MacOS X

Asymmetric multiprocessing A master CPU controls the system, and runs key kernel

tasks. Other CPUs do what the master tells them.

Variants between the two. Only one CPU allowed in the kernel at a time, but no

restriction on which one it can be. Eg. FreeBSD 4, SunOS 4

10

Distributed Systems

Distribute work across a network of computers. Machines are loosely coupled. Can be local or remote machines. Each has its own CPU, memory, disk, peripherals, etc.

Advantages: Resource sharing, eg NFS CPU speedup from sharing a task. Load balancing (I/O and CPU speedup) Resilience.

Disadvantages: High latency, so tightly coupled tasks perform poorly.

Distributed Systems (2)

Few network operating systems exist, but manydistributed subsystems:NFS local shared filesystem.AFS global shared filesystem.

11

Clustered Systems

In between multiprocessorsystems and distributed systems.

The term clustered is not welldefined. Closely linked via a LAN. Share storage.

Can be used to improveperformance, or improvereliability. Asymmetric clustering: one

node runs application, othersprovide a hot standby.

Symmetric clustering: all nodesrun parts of the application.

Mars Rovers

12

A long way from home…

Real-Time Systems

Special purpose OS, often used in a control device.Engine control systems, flight control computers,

guidance systems in missiles, medical systems,some home appliance CPUs, spacecraft.

System has well defined time constraints:Processing must be done by some deadline.

13

Real-Time Systems

Hard Realtime: Guarantees critical tasks completed on time. Delays in system must be bounded. No virtual memory, limited use of secondary storage, no

time-sharing. Eg. VxWorks

Soft Realtime: Critical tasks get priority, and keep this priority until they

complete. Common in general-purpose OSs such as Unix. Uses: multimedia, virtual reality, etc.

Handheld Devices

Personal Digital Assistants (PDAs) Mobile Phones. MP3 players. Issues:

Limited memory.Slow CPUs.Small screens.Limited battery.

14

Technology Migration

Taken from Silberschatz, OS Concepts

Conclusions

Different Systems for different purposes. Functionality driven by limitations of the hardware. Features tend to migrate from expensive to cheap systems

over time. Key Functionality:

Memory Management Scheduling Hardware Abstraction Isolation Mechanisms Filesystems