3 - introduction to operating systemsnrg.cs.ucl.ac.uk/mjh/3005/2006/3-os-intro.pdf · 3 -...

13
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: nguyenhanh

Post on 20-Aug-2018

218 views

Category:

Documents


0 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 programscan be built and run.

acts as an intermediary between the user and thehardware.

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) MacOS (7, 9) Vax VMS GEC OS4000 CP/M PDA: PalmOS, Psion 3, Psion EPOC, Linux Routers: Cisco IOS, Juniper JunOS, Procket 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 in 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 claims that Internet Explorer is part of theWindows 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

Punched Card Reader

5

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

IBM 360Operator Panel

6

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 Scheduling

Disk I/O

Memory Management

OperatingSystem

Job 1

Job 3

Job 4

Typical MemoryLayout

Job 2

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. What 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.

7

DEC PDP 11/44, IBM PC

Desktop Systems (1)

Early desktop systems had little memory, and nomemory management hardware.

CP/M, MS-DOS, MacOS

One 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 formainframes.

8

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 user, are now needed for virusisolation on networked PCs with only a single user.

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. Multi-core CPUs will be common soon.

9

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.4,

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

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.

10

Distributed Systems (2)

Few network operating systems exist, but manydistributed subsystems:

NFS local shared filesystem.

AFS global shared filesystem.

Clustered Systems

In between multiprocessor systems and distributed systems.

The term clustered is not well defined.

Closely linked via a LAN.

Share storage.

Can be used to improve performance, or improve reliability.

Asymmetric clustering: one node runs application, othersprovide a hot standby.

Symmetric clustering: all nodes run parts of theapplication.

11

Mars Rovers

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.

12

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.

13

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 systemsover time.

Key Functionality:

Memory Management

Scheduling

Hardware Abstraction

Isolation Mechanisms

Filesystems