Top Banner
PKU CS Summer Camp '12 1 Copyright © 2012 David A. Eckhardt Operating Systems??? July 10, 2012 Dave Eckhardt Dave Eckhardt Computer Science Department Computer Science Department School of Computer Science School of Computer Science Carnegie Mellon University Carnegie Mellon University PKU CS Summer Camp
51

Operating Systems??? July 10, 2012

Dec 12, 2021

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Operating Systems??? July 10, 2012

PKU CS Summer Camp '121Copyright © 2012 David A. Eckhardt

Operating Systems???

July 10, 2012

Dave EckhardtDave Eckhardt

Computer Science DepartmentComputer Science Department

School of Computer ScienceSchool of Computer Science

Carnegie Mellon UniversityCarnegie Mellon University

PKU CS Summer Camp

Page 2: Operating Systems??? July 10, 2012

PKU CS Summer Camp '122Copyright © 2012 David A. Eckhardt

Introduction

Carnegie Mellon UniversityCarnegie Mellon University“Small private research university”

Page 3: Operating Systems??? July 10, 2012

PKU CS Summer Camp '123Copyright © 2012 David A. Eckhardt

Introduction

Carnegie Mellon UniversityCarnegie Mellon University“Small private research university”

~6,100 Undergraduates

~3,800 M.S. students

~1,600 Ph.D. students

~1,400 Faculty

Page 4: Operating Systems??? July 10, 2012

PKU CS Summer Camp '124Copyright © 2012 David A. Eckhardt

Introduction

Carnegie Mellon UniversityCarnegie Mellon University“Small private research university”

~6,100 Undergraduates

~3,800 M.S. students

~1,600 Ph.D. students

~1,400 Faculty

茅以升 茅以升 (Mao Yisheng)(Mao Yisheng)First Ph.D. granted by CMU, 1919

“Secondary Stress on Frame Construction”

Bridge engineering pioneer

Lake Fong, Pittsburgh Post-Gazette

Page 5: Operating Systems??? July 10, 2012

PKU CS Summer Camp '125Copyright © 2012 David A. Eckhardt

Introduction

Computer Science DepartmentComputer Science Department ~ 80 Faculty

~150 Ph.D. students

~ 20 M.S. students

~600 Undergraduates

School of Computer ScienceSchool of Computer ScienceCSD + Machine Learning, Human-Computer Interaction,

Language Technologies, Software Engineering, Robotics

~215 Faculty

~400 Ph.D. students

~250 M.S. Students

~600 Undergraduates (all CSD)

Page 6: Operating Systems??? July 10, 2012

PKU CS Summer Camp '126Copyright © 2012 David A. Eckhardt

Dave Eckhardt

Official buzzwordsOfficial buzzwords Associate Teaching Professor, Computer Science Ph.D., Computer Science, CMU, May 2002

“An Internet-style Approach to Managing Wireless Link Errors”

What I do at CMUWhat I do at CMU Teach “Systems” courses

Operating Systems (whatever that is!) Computer Networks Introduction to Computer Systems

Who cares about “Systems” courses?? Isn't theoretical computer science “the important

part”?

Page 7: Operating Systems??? July 10, 2012

PKU CS Summer Camp '127Copyright © 2012 David A. Eckhardt

Outline

Tabula rasa and the capacitorTabula rasa and the capacitor

What is an OS?What is an OS? Why? Brief history

Illustrating some kinds of OS

OS structure?OS structure?

Beyond one machineBeyond one machine Motivating “distributed systems” Being faster and smaller and cooler

The “OS frame of mind”The “OS frame of mind”

Why study “Systems”?Why study “Systems”?

Page 8: Operating Systems??? July 10, 2012

PKU CS Summer Camp '128Copyright © 2012 David A. Eckhardt

“Tabula rasa”

(something happens)

Image credit: notebook-laptop.co.in

Image credit: epinions.com

Page 9: Operating Systems??? July 10, 2012

PKU CS Summer Camp '129Copyright © 2012 David A. Eckhardt

“Tabula Rasa”

What happens?What happens? The machine is “off” Then the power button is pressed...

Maybe the transistors are all “off”...? Maybe each transistors is randomly “on” or “off”?

Page 10: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1210Copyright © 2012 David A. Eckhardt

“Tabula Rasa”

What happens?What happens? The machine is “off” Then the power button is pressed...

Maybe the transistors are all “off”...? Maybe each transistors is randomly “on” or “off”?

“Somehow” the machine achieves an expected state Which is very complicated! 00000000000 ⇒ map of the world? Or maybe both

» 00100011000 ⇒ map of the world

» 10001000111 ⇒ map of the world

Page 11: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1211Copyright © 2012 David A. Eckhardt

“Tabula Rasa”

What happens?What happens? The machine is “off” Then the power button is pressed...

Maybe the transistors are all “off”...? Maybe each transistors is randomly “on” or “off”?

“Somehow” the machine achieves an expected state Which is very complicated! 00000000000 ⇒ map of the world? Or maybe both

» 00100011000 ⇒ map of the world

» 10001000111 ⇒ map of the world

How?? How can mass indeterminism result in order? How does “computer science” get started if the computer can't get started??

Page 12: Operating Systems??? July 10, 2012
Page 13: Operating Systems??? July 10, 2012
Page 14: Operating Systems??? July 10, 2012
Page 15: Operating Systems??? July 10, 2012
Page 16: Operating Systems??? July 10, 2012
Page 17: Operating Systems??? July 10, 2012
Page 18: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1218Copyright © 2012 David A. Eckhardt

Then...?

Execution begins in real mode at a specific memory Execution begins in real mode at a specific memory addressaddress

“Real mode” - primeval x86 addressing mode Only 1 MB of memory is addressable

First instruction fetch address is 0xFFFF0 (???)

Page 19: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1219Copyright © 2012 David A. Eckhardt

Then...?

Execution begins in real mode at a specific memory Execution begins in real mode at a specific memory addressaddress

“Real mode” - primeval x86 addressing mode Only 1 MB of memory is addressable

First instruction fetch address is 0xFFFF0 (???) “End of memory” (20-bit infinity), minus 4 Contains a jump to the actual BIOS entry point

» Great, what’s a BIOS?

Page 20: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1220Copyright © 2012 David A. Eckhardt

Basic Input/Output System (BIOS)Code stored in mostly-read-only memoryCode stored in mostly-read-only memory

Flash (previously EEPROM, previously EPROM)

Configures hardware detailsConfigures hardware details RAM refresh rate or bus speed Password protection Boot-device order

Loads OS, acts as mini-OSLoads OS, acts as mini-OS

Provides some device drivers to real OSProvides some device drivers to real OS Say, what's a “real OS”?

Page 21: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1221Copyright © 2012 David A. Eckhardt

“Real” Operating Systems

Who has a computer?Who has a computer?

Who runs an OS on that computer?Who runs an OS on that computer? Windows MacOS Linux

Ubuntu, Debian, Red Hat, SuSE, Gentoo, Slackware

FreeBSD, OpenBSD, NetBSD Plan 9, Haiku... (LoseThos???)

Why do you run that OS?Why do you run that OS?

Why do you run Why do you run anyany OS??? OS???

Page 22: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1222Copyright © 2012 David A. Eckhardt

“Just Say No”?

An operating system is a collection of things that An operating system is a collection of things that don't fit into a language. There shouldn't be one.don't fit into a language. There shouldn't be one.

Dan Ingalls (OO/UI pioneer), Byte Magazine, 1981

Page 23: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1223Copyright © 2012 David A. Eckhardt

Parts of an OS

A collection of A collection of whatwhat things? things?Frame allocator

Virtual memory

Swapper

Interrupt handler

IDT, GDT, LDT

TLB-miss handler, TLB-shootdown handler

scheduler

ksoftirqd

kthreadd

IRQ-balance daemon

Page 24: Operating Systems??? July 10, 2012
Page 25: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1225Copyright © 2012 David A. Eckhardt

What is an OS?

PalmOSPalmOS 1 user, 1 task

IBM VM/CMSIBM VM/CMS 1000 users, 1 (DOS box) task apiece

Capability-based OSCapability-based OS “User”? What do you mean by “user”?

Page 26: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1226Copyright © 2012 David A. Eckhardt

What is an OS?

Q: SizeQ: Size A1: 16 kilobytes! A2: 16 megabytes!

Q: Portable?Q: Portable? A1: “Of course!!!” A2: “Why would you want 'portability'???”

⇒⇒ Consensus elusive!Consensus elusive! “The stuff between the hardware and the

application”

Page 27: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1227Copyright © 2012 David A. Eckhardt

Common OS Features

Abstraction layerAbstraction layer People want files, not sectors People want I/O, not interrupts People want date & time, not "ticks since boot" Or: Obstruction layer

● See: “Exokernel”

Page 28: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1228Copyright © 2012 David A. Eckhardt

Common OS Features

VirtualizationVirtualization Give everybody “their own” machine IBM's VM/SP pioneered “strong” virtualization (1972)

● Your own 3081!● PC-XT/370!

Virtualization is hot again● VMware, Xen

Unix process is like a virtual machine too● (in a vague sense)

Page 29: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1229Copyright © 2012 David A. Eckhardt

Common OS Features

Protected Sharing (Protected Sharing (ControlledControlled Interference) Interference) Shared disk

● space-sliced

Shared CPU● time-sliced

Shared keyboard/display● Hmm...

Shared memory● Hmm...

N levels of shared cache● Hmm... shh...

Page 30: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1230Copyright © 2012 David A. Eckhardt

Single-process OS

ExamplesExamples DEC's RT-11 CP/M (and its clone, MS-DOS) Apple DOS UCSD p-system (1978) (Early MacOS; PalmOS)

Page 31: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1231Copyright © 2012 David A. Eckhardt

Single-process OS

Typical featuresTypical features One active program Some memory management A "file system" A command interpreter

● “Built-in” commands– DIR, SET, ^C

● “External” commands– compiler, editor

Page 32: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1232Copyright © 2012 David A. Eckhardt

Mainframe “Batch” OS

ExamplesExamples IBM HASP?

Typical featuresTypical features One active program I/O library

● Card reader, tape drive, printer

Load next program● (completion or “abend”)

WastefulWasteful Usually much of machine is idle

Image credit: IBM Archives“Mainframes photo album”

Page 33: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1233Copyright © 2012 David A. Eckhardt

Multiprogramming Batch OS

Key insightKey insight Sometimes two programs fit in memory Each program is often waiting for I/O Two for the price of one!

Page 34: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1234Copyright © 2012 David A. Eckhardt

Multiprogramming Batch OS

Typical featuresTypical features Job scheduling

● Semi-ordered entry to memory

Processor scheduling● Multiplexing CPU somehow

Input/Output stream abstraction● Virtual card reader/punch

Memory mapping or linkage discipline (Hopefully) crash isolation

ExamplesExamples IBM MVT, MVS

Page 35: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1235Copyright © 2012 David A. Eckhardt

Timesharing

Key InsightKey Insight (none)

Timesharing = Timesharing = InteractiveInteractive Multiprogramming Multiprogramming Memory cheap enough for lots of processes Terminals cheap enough for lots of users

Page 36: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1236Copyright © 2012 David A. Eckhardt

Timesharing

ExamplesExamples CTS, ITS, TENEX MVS/TSO VM/CMS Multics Unix

Page 37: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1237Copyright © 2012 David A. Eckhardt

Timesharing

Typical featuresTypical features Swapping processes out of memory to disk

A good idea: lots of them are idle!

Virtual memory Fancy process scheduling (priorities, ...)

Inter-user/inter-process Inter-user/inter-process communication!communication! Why not? You're all logged in all day...

Page 38: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1238Copyright © 2012 David A. Eckhardt

Other Visions

MulticsMultics What if computing were a utility like the telephone? What if one mainframe supported everybody in a

whole city? What would the OS be like?

Timesharing on a grand scale Secure, hopefully!

Invented many “modern” OS technologies Hierarchical file system Hot-pluggable disks Hot-pluggable DRAM, CPUs!

In use from 1965 to 2000

Page 39: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1239Copyright © 2012 David A. Eckhardt

Other Visions

The Humane InterfaceThe Humane Interface Jef Raskin (designer of Mac UI) Design user interface according to cognitive psych Then design all other software in system User should never see “operating system”

Nor “applications” either!

ExamplesExamples “Canon Cat” computer (1987), marketed as a word-

processing appliance Partial submergence of Windows beneath browser,

e-mail, office suite

Image credit: old-computers.net

Page 40: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1240Copyright © 2012 David A. Eckhardt

History of OS structures

PrimevalPrimeval OS and program share the machine

(program crashes the OS)

Protection!Protection! “User mode” and “kernel mode”

“Kernel” is protected from “user”

Gives rise to “monolith”

LayersLayers Protect parts of the OS from each other

““kernel” / “hypervisor”kernel” / “hypervisor” Multiple “OS's” on one substrate

Page 41: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1241Copyright © 2012 David A. Eckhardt

Have we learned anything?

Which structure is right?Which structure is right? Monolith, layers, microkernels, or hypervisors?

Nobody knows!Nobody knows! Today: mostly monoliths

Frequently multiple monoliths on a hypervisor

Research OS's: mostly not monoliths

Page 42: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1242Copyright © 2012 David A. Eckhardt

Outline

Tabula rasa and the capacitorTabula rasa and the capacitor

What is an OS?What is an OS? Why? Brief history

Illustrating some kinds of OS

OS structure?OS structure?

Beyond one machineBeyond one machine Motivating “distributed systems” Being faster and smaller and cooler

The “OS frame of mind”The “OS frame of mind”

Why study “Systems”?Why study “Systems”?

Page 43: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1243Copyright © 2012 David A. Eckhardt

Real-time Systems

SomSometimes time mattersetimes time matters Music

“small” glitches sound bad

Gaming must match hand/eye coordination

Factory process control Watch out for the steel slab!

Avionics

Page 44: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1244Copyright © 2012 David A. Eckhardt

Mobile Computing

ExamplesExamples PDAs Laptops “Sensor” networks

Standard resources are tightStandard resources are tight Memory Processor speed Screen size Power

Page 45: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1245Copyright © 2012 David A. Eckhardt

Distributed Systems

ConceptConcept The world is large, so communication is hard

Yodeling from one mountain peak to another Standage, Victorian Internet

Page 46: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1246Copyright © 2012 David A. Eckhardt

Distributed Systems

Client-serverClient-server WWW File service

Message passing / “Peer-to-peer”Message passing / “Peer-to-peer” e-mail USENET Music/movie “sharing” “Ad-hoc networking” “Sensor” nets

Page 47: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1247Copyright © 2012 David A. Eckhardt

Distributed-System Challenges

Time delays may be largeTime delays may be large Asimov, Foundation (series) Vinge, Fire Upon the Deep Clarke, Songs of Distant Earth

Group membership generally un-knowableGroup membership generally un-knowable

Temporal coherence often very weakTemporal coherence often very weak

Messages must be somewhat self-containedMessages must be somewhat self-contained

No authority to trustNo authority to trust

Page 48: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1248Copyright © 2012 David A. Eckhardt

Distributed-System Advantages!

Large systems can grow with minimal central Large systems can grow with minimal central planningplanning

Large, useful systemsLarge, useful systems e-mail, USENET, WWW

Aggregate throughput can be enormousAggregate throughput can be enormous

Systems can keep working despite damageSystems can keep working despite damage

Page 49: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1249Copyright © 2012 David A. Eckhardt

OS Summary

Resource abstractionResource abstraction Packets ⇒ reliable byte streams

Disk sectors ⇒ files

Resource sharing/protectionResource sharing/protection CPU time slicing Memory swapping/paging Disk quotas

Communication & SynchronizationCommunication & Synchronization Messaging Synchronizing & coherence

Page 50: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1250Copyright © 2012 David A. Eckhardt

The “OS Frame of Mind”

Narrow definitionNarrow definition OS = layer between hardware and application

The “OS frame of mind”The “OS frame of mind” High-performance web server IMAP mail server for 20,000 users IP router Smartcard Database Distributed systems: “Grid”, “Cloud”...

Page 51: Operating Systems??? July 10, 2012

PKU CS Summer Camp '1251Copyright © 2012 David A. Eckhardt

Why Study “Systems”?

The world is full of hard problemsThe world is full of hard problems Designing helpful abstractions Building systems that many people can use at the

same time Ensuring system reliability despite hardware failures Controlling sharing/interference/attacks Saving energy!

Theoretical CS can tell us where to go...Theoretical CS can tell us where to go... ...but getting there is a full-time job!