CS 134: Operating Systems Definitions, Abstractions, Taxonomies, - - PowerPoint PPT Presentation

cs 134 operating systems
SMART_READER_LITE
LIVE PREVIEW

CS 134: Operating Systems Definitions, Abstractions, Taxonomies, - - PowerPoint PPT Presentation

CS34 2012-12-06 CS 134: Operating Systems Definitions, Abstractions, Taxonomies, Early History CS 134: Operating Systems Definitions, Abstractions, Taxonomies, Early History 1 / 36 Overview CS34 Overview 2012-12-06 What Is an OS?


slide-1
SLIDE 1

CS 134: Operating Systems

Definitions, Abstractions, Taxonomies, Early History

1 / 36

CS 134: Operating Systems

Definitions, Abstractions, Taxonomies, Early History

2012-12-06

CS34

slide-2
SLIDE 2

Overview

What Is an OS? History Hardware

2 / 36

Overview

What Is an OS? History Hardware

2012-12-06

CS34 Overview

slide-3
SLIDE 3

What Is an OS?

What is an Operating System Anyway?

Class Exercise: Devise three separate definitions. Discuss.

3 / 36

What is an Operating System Anyway?

Class Exercise: Devise three separate definitions. Discuss.

2012-12-06

CS34 What Is an OS? What is an Operating System Anyway?

Several slides follow that aren’t on handout.

slide-4
SLIDE 4

What Is an OS?

It’s A Programmer’s Toolkit

Provide useful functionality to programs:

◮ Prevent duplicated work ◮ Promote reuse

4 / 36

It’s A Programmer’s Toolkit

Provide useful functionality to programs:

◮ Prevent duplicated work ◮ Promote reuse

2012-12-06

CS34 What Is an OS? It’s A Programmer’s Toolkit

slide-5
SLIDE 5

What Is an OS?

It’s a Control Program

Provide the rules for the how the machine will operate:

◮ Control the operation of the I/O devices ◮ Ensure smooth running of the machine

5 / 36

It’s a Control Program

Provide the rules for the how the machine will operate:

◮ Control the operation of the I/O devices ◮ Ensure smooth running of the machine

2012-12-06

CS34 What Is an OS? It’s a Control Program

slide-6
SLIDE 6

What Is an OS?

It’s an Abstraction Layer

Make the machine “nicer”, easier to program, higher level. . .

◮ Hide some of the idiosyncrasies of the machine ◮ Provide functionality the underlying machine doesn’t have Hardware Operating System Application User

6 / 36

It’s an Abstraction Layer

Make the machine “nicer”, easier to program, higher level. . .

◮ Hide some of the idiosyncrasies of the machine ◮ Provide functionality the underlying machine doesn’t have Hardware Operating System Application User

2012-12-06

CS34 What Is an OS? It’s an Abstraction Layer

slide-7
SLIDE 7

What Is an OS?

It’s an Abstraction Layer

Make the machine “nicer”, easier to program, higher level. . .

◮ Hide some of the idiosyncrasies of the machine ◮ Provide functionality the underlying machine doesn’t have Hardware Operating System Application User

BSD Carbon Cocoa Java (JDK) BSD Classic Core Services Kernel environment QuickTime Application Services Application environment

6 / 36

It’s an Abstraction Layer

Make the machine “nicer”, easier to program, higher level. . .

◮ Hide some of the idiosyncrasies of the machine ◮ Provide functionality the underlying machine doesn’t have Hardware Operating System Application User

BSD Carbon Cocoa Java (JDK) BSD Classic Core Services Kernel environment QuickTime Application Services Application environment

2012-12-06

CS34 What Is an OS? It’s an Abstraction Layer

slide-8
SLIDE 8

What Is an OS?

It’s a Virtual Machine

OS provides an environment This environment can be seen as a “new machine”. . . Hardware —Physical machine + Core OS —Virtual machine + OS Libraries —Virtual machine + OS Utilities —Virtual machine + Application —Virtual machine

7 / 36

It’s a Virtual Machine

OS provides an environment This environment can be seen as a “new machine”. . . Hardware —Physical machine + Core OS —Virtual machine + OS Libraries —Virtual machine + OS Utilities —Virtual machine + Application —Virtual machine

2012-12-06

CS34 What Is an OS? It’s a Virtual Machine

slide-9
SLIDE 9

What Is an OS?

It’s a Protection Layer

Make the machine more robust—less scope for a bug to have devastating consequences

◮ OS does everything programs can’t be trusted to do ◮ OS makes programs play nice with others

8 / 36

It’s a Protection Layer

Make the machine more robust—less scope for a bug to have devastating consequences

◮ OS does everything programs can’t be trusted to do ◮ OS makes programs play nice with others

2012-12-06

CS34 What Is an OS? It’s a Protection Layer

slide-10
SLIDE 10

What Is an OS?

It’s a Policy Enforcer

OS provides the mechanisms to enforce various policies

9 / 36

It’s a Policy Enforcer

OS provides the mechanisms to enforce various policies

2012-12-06

CS34 What Is an OS? It’s a Policy Enforcer

slide-11
SLIDE 11

What Is an OS?

It’s a Policy Enforcer

OS provides the mechanisms to enforce various policies Class Exercise: Examples?

9 / 36

It’s a Policy Enforcer

OS provides the mechanisms to enforce various policies Class Exercise: Examples?

2012-12-06

CS34 What Is an OS? It’s a Policy Enforcer

slide-12
SLIDE 12

What Is an OS?

It’s a Resource Manager

The operating system manages physical resources:

◮ Processor ◮ Memory ◮ Storage devices ◮ Network devices

  • etc. . .

10 / 36

It’s a Resource Manager

The operating system manages physical resources:

◮ Processor ◮ Memory ◮ Storage devices ◮ Network devices

  • etc. . .

2012-12-06

CS34 What Is an OS? It’s a Resource Manager

slide-13
SLIDE 13

What Is an OS?

It’s a Resource Manager (cont’d.)

The operating system manages virtual resources:

◮ Processes ◮ Files ◮ Users ◮ Network connections ◮ Windows

etc.. . .

11 / 36

It’s a Resource Manager (cont’d.)

The operating system manages virtual resources:

◮ Processes ◮ Files ◮ Users ◮ Network connections ◮ Windows

etc.. . .

2012-12-06

CS34 What Is an OS? It’s a Resource Manager (cont’d.)

slide-14
SLIDE 14

What Is an OS?

It’s a Product

Many operating systems are sold by commercial companies

◮ Market vs. technical considerations ◮ The operating system is what comes in the box marked

“operating system”

12 / 36

It’s a Product

Many operating systems are sold by commercial companies

◮ Market vs. technical considerations ◮ The operating system is what comes in the box marked

“operating system”

2012-12-06

CS34 What Is an OS? It’s a Product

slide-15
SLIDE 15

What Is an OS?

Fundamental Abstractions

What are the (user-level) abstractions we’d expect to find in a modern OS?

13 / 36

Fundamental Abstractions

What are the (user-level) abstractions we’d expect to find in a modern OS?

2012-12-06

CS34 What Is an OS? Fundamental Abstractions

slide-16
SLIDE 16

What Is an OS?

Fundamental Abstractions

  • Include. . .

◮ System calls ◮ Processes

◮ Threads ◮ Address spaces

◮ Files

◮ Files ◮ Directories ◮ Filesystems

◮ Events

◮ Asynchronous ◮ Synchronous

◮ IPC Mechanisms

◮ Semaphores ◮ Mutexes ◮ Condition Variables

◮ Communications channels

◮ Pipelines ◮ Network connections

◮ Users ◮ (Remote) Hosts

14 / 36

Fundamental Abstractions

  • Include. . .

◮ System calls ◮ Processes ◮ Threads ◮ Address spaces ◮ Files ◮ Files ◮ Directories ◮ Filesystems ◮ Events ◮ Asynchronous ◮ Synchronous ◮ IPC Mechanisms ◮ Semaphores ◮ Mutexes ◮ Condition Variables ◮ Communications channels ◮ Pipelines ◮ Network connections ◮ Users ◮ (Remote) Hosts

2012-12-06

CS34 What Is an OS? Fundamental Abstractions

slide-17
SLIDE 17

What Is an OS?

It’s a Resource Manager

What are the “resources” that an operating system manages?

15 / 36

It’s a Resource Manager

What are the “resources” that an operating system manages?

2012-12-06

CS34 What Is an OS? It’s a Resource Manager

slide-18
SLIDE 18

What Is an OS?

It’s a Resource Manager

The operating system manages physical resources:

◮ Processor ◮ Memory ◮ Storage devices ◮ Network devices

etc.. . .

16 / 36

It’s a Resource Manager

The operating system manages physical resources:

◮ Processor ◮ Memory ◮ Storage devices ◮ Network devices

etc.. . .

2012-12-06

CS34 What Is an OS? It’s a Resource Manager

slide-19
SLIDE 19

What Is an OS?

It’s a Resource Manager (cont’d.)

The operating system manages virtual resources:

◮ Processes ◮ Files ◮ Users ◮ Network connections ◮ Windows

etc.. . .

17 / 36

It’s a Resource Manager (cont’d.)

The operating system manages virtual resources:

◮ Processes ◮ Files ◮ Users ◮ Network connections ◮ Windows

etc.. . .

2012-12-06

CS34 What Is an OS? It’s a Resource Manager (cont’d.)

slide-20
SLIDE 20

What Is an OS?

Taxonomy of Computer Systems

Different computer systems ask different things from their OS

18 / 36

Taxonomy of Computer Systems

Different computer systems ask different things from their OS

2012-12-06

CS34 What Is an OS? Taxonomy of Computer Systems

slide-21
SLIDE 21

What Is an OS?

Taxonomy of Computer Systems

Different computer systems ask different things from their OS Class Exercise: Give some dimensions across which computer systems vary

18 / 36

Taxonomy of Computer Systems

Different computer systems ask different things from their OS Class Exercise: Give some dimensions across which computer systems vary

2012-12-06

CS34 What Is an OS? Taxonomy of Computer Systems

slide-22
SLIDE 22

What Is an OS?

Partial Taxonomy of Computer Systems

Different computer systems ask different things from their OS: Special-purpose ↔ General-purpose Single-user ↔ Multi-user Non–Resource-sharing ↔ Resource sharing Single processor ↔ Multiprocessor Stand alone ↔ Networked Centralized ↔ Distributed Batch ↔ Interactive Deadline-free ↔ Real-time Insecure ↔ Secure Symmetric ↔ Asymmetric Simple ↔ Complex Small ↔ Large Inexpensive ↔ Expensive etc.

19 / 36

Partial Taxonomy of Computer Systems

Different computer systems ask different things from their OS: Special-purpose ↔ General-purpose Single-user ↔ Multi-user Non–Resource-sharing ↔ Resource sharing Single processor ↔ Multiprocessor Stand alone ↔ Networked Centralized ↔ Distributed Batch ↔ Interactive Deadline-free ↔ Real-time Insecure ↔ Secure Symmetric ↔ Asymmetric Simple ↔ Complex Small ↔ Large Inexpensive ↔ Expensive etc.

2012-12-06

CS34 What Is an OS? Partial Taxonomy of Computer Systems

slide-23
SLIDE 23

History

Early Computers

1950s—large complex machines

◮ Operated directly from a console ◮ Used interactively by a single user ◮ Ran one program at a time (uniprogramming) ◮ Read data from paper tape, punched cards, or toggle

switches OS? Maybe a library containing code to work the I/O devices was useful.

20 / 36

Early Computers

1950s—large complex machines

◮ Operated directly from a console ◮ Used interactively by a single user ◮ Ran one program at a time (uniprogramming) ◮ Read data from paper tape, punched cards, or toggle

switches OS? Maybe a library containing code to work the I/O devices was useful.

2012-12-06

CS34 History Early Computers

slide-24
SLIDE 24

History

Simple Batch Systems

Provide better use of resources:

◮ Users access computer indirectly ◮ Programs and input (jobs) taken from a batch queue ◮ Computer has a human operator to feed it jobs

1401 7094 1401 Card reader Tape drive Input tape Output tape System tape Printer

Need to:

◮ Manage the jobs: ◮ Protect the next program from the previous program

21 / 36

Simple Batch Systems

Provide better use of resources:

◮ Users access computer indirectly ◮ Programs and input (jobs) taken from a batch queue ◮ Computer has a human operator to feed it jobs 1401 7094 1401 Card reader Tape drive Input tape Output tape System tape Printer

Need to:

◮ Manage the jobs: ◮ Protect the next program from the previous program

2012-12-06

CS34 History Simple Batch Systems

slide-25
SLIDE 25

History

SPOOLing Batch Systems

Provide better use of resources—buffer input and output

◮ Read-ahead input from disk/tape ◮ Write-behind output to disk/tape

22 / 36

SPOOLing Batch Systems

Provide better use of resources—buffer input and output

◮ Read-ahead input from disk/tape ◮ Write-behind output to disk/tape

2012-12-06

CS34 History SPOOLing Batch Systems

slide-26
SLIDE 26

History

SPOOLing Batch Systems

Provide better use of resources—buffer input and output

◮ Read-ahead input from disk/tape ◮ Write-behind output to disk/tape

Class Exercise: Why does buffering improve performance? Does buffering always improve performance? (What assumptions are we making?)

22 / 36

SPOOLing Batch Systems

Provide better use of resources—buffer input and output

◮ Read-ahead input from disk/tape ◮ Write-behind output to disk/tape

Class Exercise: Why does buffering improve performance? Does buffering always improve performance? (What assumptions are we making?)

2012-12-06

CS34 History SPOOLing Batch Systems

slide-27
SLIDE 27

History

Multiprogrammed Batch Systems

Provide better use of resources—multiplex the processor:

◮ Run multiple independent programs at once ◮ Switch to another program when running program waits for

I/O More work for OS. More complex management of

◮ I/O ◮ Memory ◮ Processor

23 / 36

Multiprogrammed Batch Systems

Provide better use of resources—multiplex the processor:

◮ Run multiple independent programs at once ◮ Switch to another program when running program waits for

I/O More work for OS. More complex management of

◮ I/O ◮ Memory ◮ Processor

2012-12-06

CS34 History Multiprogrammed Batch Systems

slide-28
SLIDE 28

History

Time-Sharing Systems

Provide better environment for users—multiplex the processor between users:

◮ Run multiple independent programs at once ◮ Switch between users rapidly

◮ Illusion of having the machine’s full attention

Yet more complexity for OS:

24 / 36

Time-Sharing Systems

Provide better environment for users—multiplex the processor between users:

◮ Run multiple independent programs at once ◮ Switch between users rapidly ◮ Illusion of having the machine’s full attention

Yet more complexity for OS:

2012-12-06

CS34 History Time-Sharing Systems

slide-29
SLIDE 29

History

History Repeats Itself

As new, “smaller” hardware appears, it tends to repeat this evolution

◮ Mini computers ◮ Personal computers ◮ PDAs ◮ Embedded systems

◮ Cell phones ◮ MP3 Players ◮ Cameras, etc. 25 / 36

History Repeats Itself

As new, “smaller” hardware appears, it tends to repeat this evolution

◮ Mini computers ◮ Personal computers ◮ PDAs ◮ Embedded systems ◮ Cell phones ◮ MP3 Players ◮ Cameras, etc.

2012-12-06

CS34 History History Repeats Itself

slide-30
SLIDE 30

Hardware

Computer Hardware

tape drives printer disk disk CPU disk controller printer controller tape-drive controller memory memory controller system bus

  • n-line

26 / 36

Computer Hardware

tape drives printer disk disk CPU disk controller printer controller tape-drive controller memory memory controller system bus

  • n-line

2012-12-06

CS34 Hardware Computer Hardware

slide-31
SLIDE 31

Hardware

Computer Hardware—CPU & Memory

Need to perform computation!

Fetch Instruction Execute Instruction Start

◮ Memory contains program instructions and program data ◮ Processor registers maintain processor state. Registers

include:

◮ General purpose (address & data) registers ◮ Instruction pointer (aka program counter) ◮ Stack pointer(s) ◮ Control and status registers 27 / 36

Computer Hardware—CPU & Memory

Need to perform computation! Fetch Instruction Execute Instruction Start

◮ Memory contains program instructions and program data ◮ Processor registers maintain processor state. Registers

include:

◮ General purpose (address & data) registers ◮ Instruction pointer (aka program counter) ◮ Stack pointer(s) ◮ Control and status registers

2012-12-06

CS34 Hardware Computer Hardware—CPU & Memory

slide-32
SLIDE 32

Hardware

Computer Hardware—I/O Devices

Need to communicate with the world!

◮ I/O devices and CPU execute concurrently ◮ Devices have hardware controllers

◮ Handles devices of a particular device type ◮ Some level of autonomy ◮ Local buffer

◮ I/O is from the device to local buffer of controller

tape drives printer disk disk CPU disk controller printer controller tape-drive controller memory memory controller system bus

  • n-line

28 / 36

Computer Hardware—I/O Devices

Need to communicate with the world!

◮ I/O devices and CPU execute concurrently ◮ Devices have hardware controllers ◮ Handles devices of a particular device type ◮ Some level of autonomy ◮ Local buffer ◮ I/O is from the device to local buffer of controller

tape drives printer disk disk CPU disk controller printer controller tape-drive controller memory memory controller system bus
  • n-line

2012-12-06

CS34 Hardware Computer Hardware—I/O Devices

slide-33
SLIDE 33

Hardware

Programmed I/O

After I/O starts, control returns to user program only on I/O completion

◮ CPU waits until I/O completes. ◮ At most one I/O request is outstanding at a time

◮ No simultaneous I/O processing 29 / 36

Programmed I/O

After I/O starts, control returns to user program only on I/O completion

◮ CPU waits until I/O completes. ◮ At most one I/O request is outstanding at a time ◮ No simultaneous I/O processing

2012-12-06

CS34 Hardware Programmed I/O

slide-34
SLIDE 34

Hardware

Polled I/O

Polling == Querying the I/O device Separate I/O into two parts:

◮ Initiation ◮ Polling

Advantages?

30 / 36

Polled I/O

Polling == Querying the I/O device Separate I/O into two parts:

◮ Initiation ◮ Polling

Advantages?

2012-12-06

CS34 Hardware Polled I/O

slide-35
SLIDE 35

Hardware

Interrupt-Driven I/O

Separate I/O into two parts:

◮ Initiation ◮ Asynchronous notification

31 / 36

Interrupt-Driven I/O

Separate I/O into two parts:

◮ Initiation ◮ Asynchronous notification

2012-12-06

CS34 Hardware Interrupt-Driven I/O

slide-36
SLIDE 36

Hardware

I/O in User-Level Code

User-level code almost always uses “programmed I/O” (e.g. read and write on a file) Why?

32 / 36

I/O in User-Level Code

User-level code almost always uses “programmed I/O” (e.g. read and write on a file) Why?

2012-12-06

CS34 Hardware I/O in User-Level Code

slide-37
SLIDE 37

Hardware

Computer Hardware—CPU with Interrupts

CPU needs another feature. . .

Fetch Instruction Execute Instruction Start Interrupts Enabled? No Yes Interrupt? No Yes Save State Jump to Handler

33 / 36

Computer Hardware—CPU with Interrupts

CPU needs another feature. . .

Fetch Instruction Execute Instruction Start Interrupts Enabled? No Yes Interrupt? No Yes Save State Jump to Handler

2012-12-06

CS34 Hardware Computer Hardware—CPU with Interrupts

slide-38
SLIDE 38

Hardware

Handling an Interrupt

What needs to happen:

◮ Save state

◮ All registers ◮ Switch stacks?

◮ Find out what interrupt was. . .

◮ Polling ◮ Vectored interrupts 34 / 36

Handling an Interrupt

What needs to happen:

◮ Save state ◮ All registers ◮ Switch stacks? ◮ Find out what interrupt was. . . ◮ Polling ◮ Vectored interrupts

2012-12-06

CS34 Hardware Handling an Interrupt

slide-39
SLIDE 39

Hardware

Types of Interrupts

Various types

◮ Software exception (also called a trap) ◮ Timer ◮ I/O ◮ Hardware failure

A modern operating system is interrupt driven

35 / 36

Types of Interrupts

Various types

◮ Software exception (also called a trap) ◮ Timer ◮ I/O ◮ Hardware failure

A modern operating system is interrupt driven

2012-12-06

CS34 Hardware Types of Interrupts

slide-40
SLIDE 40

Hardware

Other Hardware Features

We’ve covered interrupts, but hardware has other cool features, including:

◮ Caches ◮ Memory management ◮ Protection

We’ll come back to hardware as we address these topics.

36 / 36

Other Hardware Features

We’ve covered interrupts, but hardware has other cool features, including:

◮ Caches ◮ Memory management ◮ Protection

We’ll come back to hardware as we address these topics.

2012-12-06

CS34 Hardware Other Hardware Features