operating systems cmpsci 377

35
Operating Systems CMPSCI 377 Introduction UNIVERSITY OF NIVERSITY OF MASSACHUSETTS ASSACHUSETTS AMHERST MHERST Department of Computer Science Department of Computer Science Emery Berger University of Massachusetts Amherst

Upload: others

Post on 21-Feb-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Operating Systems

CMPSCI 377

Introduction

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science

Emery Berger

University of Massachusetts Amherst

Introduction

Today’s Class

� Organizational meeting

� Course organization & outline

� Policies

� Prerequisites & course sign-up

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 2

� Intro to (operating) systems

Organizational Information

� Course web page� Visit www.cs.umass.edu/~emery

� Contact info� [email protected]

� Office hours Th 4-5, CS344

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 3

� Office hours Th 4-5, CS344

� TA’s:� Devesh Agrawal ([email protected])

� Office hours: Friday 1-2pm

� Walker Duhon (wduhon@cs)

� Discussion section:� W 12:20 – 1:10, ELAB 304

Class Information

� Class: junior or senior-level

� Not intended for freshman or sophomores

� Prerequisites

� CMPSCI 187 (Data Structures)

CMPSCI 201 (Architecture)

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 4

� CMPSCI 201 (Architecture)

� Enrollment policy

� Graduating seniors have preference

� Principles of Computer System Design

� Required text

� Available at CopyCat: course packet 234

Course Requirements

Note: Percentages are subject to revision.

� Class participation: 10%

� Includes credit-only in-class work

� & scribing class notes (starting next lecture)

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 5

� Programming projects: 40%

� Strict late policy! – not accepted without

medical note from UMass

� In-class exams: 50%

Plagiarism

� Cheaters will be found and punished

� We use sophisticated software that detects

plagiarized programs, + manual inspection

� Cheating includes:

� “Borrowing” code from someone

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 6

� “Borrowing” code from someone

� This includes reading previous solutions

� Giving code to someone

� Copying code from anyone (including the net)

� Hiring someone to write your code

� Submitting someone else’s code as your own

Names & Pictures

� So I can learn everyone’s name fast

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 7

What’s An Operating System?

� Definition has changed over years

� Originally, very bare bones

� Now, includes more and more

� Bill Gates: Windows =

Everything in other operating systems

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 8

� Everything in other operating systems

+ Internet Explorer

+Media player

+ “even a ham sandwich” (DOJ vs. Microsoft)

OS: Traditional View

� Interface between user

and architecture

� Hides architectural

details

� Implements virtual

User-level Applications

Operating System

virtual machine interface

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 9

� Implements virtual

machine:

� Easier to program than

raw hardware (hopefully)

� Provides services and

coordinates machine

activities

Operating System

Hardware

physical machine interface

New Developments in OS Design

� Operating systems: active field of research

� Demands on OS’s growing

� New application spaces (Web, Grid)

� Rapidly evolving hardware

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 10

� Advent of open-source operating systems –

Linux

� You can contribute to and develop OS’s!

� Excellent research platform

Operating Computer Systems

� What this class is really about

--------------

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 11

Building Large Computer Systems

� Goals: Fast, reliable, large scale

� To build these systems, you need to know

� Each computer:

� Architectural details that matter

C and C++ (nitty gritty & more)

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science

� C and C++ (nitty gritty & more)

� Memory management & locality

� Concurrency & scheduling

� Disks, network, file systems

� Across cluster:

� Server architectures

� Distributed computing, file systems

12

History of Operating Systems

� And now, for some historical context

� From mainframes to web-based systems

in nine slides

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 13

The Dark Ages (1940’s-1960’s)

Hardware: expensive;

humans: cheap

� Evolution of functionality:

� One user

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 14

� One user

� Batch processing

� Overlap of I/O & computation

� Multiprogramming

1. Single-User Computers

� One user at a time on console

� Computer executes one function at a time

� No overlap: computation & I/O

� User must be at console to debug

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 15

User must be at console to debug

Multiple users = inefficient use of machine

2. Batch Processing

� Execute multiple “jobs” in batch:� Load program

� Run

� Print results, dump machine state

� Repeat

Users submit jobs (on cards or tape)

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 16

� Users submit jobs (on cards or tape)

� Human schedules jobs

� Operating system loads & runs jobs

More efficient use of machine, complicates debugging

3. Overlap I/O and Computation

� Before: machine waits for I/O to complete

� New approach:

� Allow CPU to execute while waiting

� Add buffering

� Data fills “buffer” and then output

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 17

� Data fills “buffer” and then output

� and interrupt handling

� I/O events trigger a signal (“interrupt”)

More efficient use of machine, but still one

job at a time

4. Multiprogramming

� Allow several programs to run at same

time

� Run one job until I/O

� Run another job, etc.

OS manages interaction between

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 18

� OS manages interaction between

programs:

� Which jobs to run (schedule)

� Protects program’s memory from others

� Decides which to resume when CPU available

OS Complexity

� Increased functionality & complexity

� First OS failures

� Multics (GE & MIT):

announced 1963, released 1969

OS/360 released with 1000 known bugs

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 19

� OS/360 released with 1000 known bugs

� Need to treat OS design scientifically

� Managing complexity becomes key to…

The Renaissance (1970’s)

Hardware: cheap; humans: expensive

� Users share system via terminals

� The UNIX era

� Multics:

� army of programmers, six years

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 20

� army of programmers, six years

� UNIX:

� three guys, two years

� “Shell”: composable commands

� No distinction between programs & data

� But: response time & thrashing

The Industrial Revolution (1980’s)

Hardware very cheap;

humans expensive

� Widespread use of PCs� IBM PC: 1981, Macintosh:

1984

Simple OS (DOS, MacOS)

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 21

� Simple OS (DOS, MacOS)� No

multiprogramming, concurrency, memory protection, virtual memory, …

� Later: networking, file-sharing, remote printing…

� GUI added to OS (“WIMP”)

The Modern Era (1990’s-now)

Hardware cheap; processing demands increasing

� “Real” operating systems on PC’s

� NT (1991); Mac OS X; Linux

� Different modalities:

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 22

� Real-time: Strict or loose deadlines

� Sensor networks: Many small computers

� Parallel: Multiple processors, one machine

� Distributed: Multiple networked processors

� Think P2P, the Web, Google

Moral of the Story

� The only constant: Change

� In 50 years, almost every computer component now

9 orders of magnitude faster, larger, cheaper

examples 1983 1999

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 23

MIPS 0.5 500

cost/MIP $100,000 $500

memory 1 MB 1 GB

network 10 Mbit/s 1 GB/s

disk 1 GB 1 Tbyte

Moral of the Story, II

� No counterpart in any other sphere of

human existence!

� Transportation:

� horseback (10 mph) to Concorde (1000 mph)

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 24

� 200 years – 2 orders of magnitude

� Communication:

� Pony Express (10 mph) to telephone (600 million

mph)

� 100 years – 7 orders of magnitude

Orders of Magnitude

� 100

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 25

Orders of Magnitude

� 101

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 26

Orders of Magnitude

� 102

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 27

Orders of Magnitude

� 103

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 28

Orders of Magnitude

� 104

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 29

Orders of Magnitude

� 105

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 30

Orders of Magnitude

� 106

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 31

Orders of Magnitude

� 107

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 32

Orders of Magnitude

� 108

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 33

Orders of Magnitude

� 109

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 34

Coming Soon

� Moore’s Law – running out of steam

� New features coming to computer near

you:

� Multiple cores

UUNIVERSITY OF NIVERSITY OF MMASSACHUSETTS ASSACHUSETTS AAMHERST • MHERST • Department of Computer ScienceDepartment of Computer Science 35

� Unreliable memory

� Serious power/heat constraints

� Other tradeoffs possible

� Computing power for reliability…