DOC PREVIEW
Princeton COS 126 - Lecture

This preview shows page 1-2-3-4 out of 11 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS 126 Lecture S2:Operating SystemsCS12623-1 Randy WangOutline•Introductions•History•General mechanisms•Process management•Memory management•File systems•ConclusionsCS12623-2 Randy WangWhy Learn About OS•Be an informed citizen in the age of hype, controversies, and lawyer talks•Learn something about a big part of your daily computing life•Gain an appreciation of “the big picture”- In terms of the crucial role of technology advance, and- In terms of synthesis of many areas of computer science: hardware, algorithms, language, and ...•Gain some insight into how to put together arguably one of the most challenging softwaresCS12623-3 Randy WangOS as Government•Everyone learns to hate it, but you will miss it dearly if it’s not there•Makes lives easy: virtualizing resources: promises everyone illusions of- separate dedicated CPUs (using a single CPU)- unlimited amount of memory (using limited physical memory)- directories and files (using disk blocks)•Makes lives easy: providing standard services:- development environment- standard libraries- window systems•Makes lives fair: arbitrate competing resource demands•Makes lives safer: prevent accidental or malicious damage/intrusion•A good way of understanding OS is to look at the history of where they come from... (We keep going back to the future!)CS12623-4 Randy WangOutline•Introductions•History•General mechanisms•Process management•Memory management•File systems•ConclusionsCS12623-5 Randy WangPhase 0: User at Console•How things work- One TOY machine for CS126, what do we do?- No OS, just a sign-up sheet for reservations!- Each user has complete control of machine- Soon added device libraries, compilers, assemblers for convenience•Advantages- Interactive!- No one can hurt anyone else•Disadvantages- Reservations not accurate, leads to inefficiency- Loading/unloading tapes and cards takes forever and leaves the machine idleCS12623-6 Randy WangPhase 1: Batch Processing(Expensive Hardware, Cheap Humans)•How things work- Sort jobs and batch those with similar needs to reduce unnecessary setup time- A resident monitor provides “automatic job sequencing”: it interprets “control cards” to automatically run a bunch of programs without human intervention•Advantage- Good utilization of machine, (jargon: high throughput: jobs per second)•Problems- Loss of interactivity (unsolvable)- One job can screw up other jobs, need protection (solvable)CS12623-7 Randy WangPhase 2: Interactive Time-Sharing(Cheap Hardware, Expensive Humans)•How things work- Multiple cheap terminals for multiple users per single machine- OS keeps multiple programs active at the same time and switches among them rapidly to provide the illusion of one machine per user•Advantage: interactivity, sharing (collaboration)•Problems- Must provide reasonable response time (hard sometimes) - Must provide human friendly interfaces: command shell, hierarchical name structure for file systems, etc. (solvable)- Higher degree of multiprogramming places heavier demand on protection mechanism (solvable but hard)CS12623-8 Randy WangPhase 3: Personal Computing(Very Cheap Hardware, Very Expensive Humans)•How things work- One machine per person, now several machines per person- Initially, OS goes back to “square 1” (like those of Phase 0)- Later added back multiprogramming and memory protection•Advantages- Better response time- Protection becomes a little easier•Problems- How do you share information? (sill not solved)•What’s next? Networked ubiquitous computing?- Much of what we will talk about is motivated by the Phase 0-3 historical developments.- Is the next phase fundamentally different? What kind of OS do we need then?CS12623-9 Randy WangTechnology Advances Determine OS 19811999FactorMIPS110001,000$/MIPS$100K$520,000DRAM Capacity128KB256MB2,000Disk Capacity10MB50GB5,000Network B/W9600b/s155Mb/s15,000Address Bits16644Users/Machine10s<= 1< 0.1CS12623-10 Randy WangOutline•Introductions•History•General mechanisms•Process management•Memory management•File systems•ConclusionsCS12623-11 Randy WangDual-Mode Operation•The machine has two modes of operation: user mode and kernel mode (also called monitor mode, supervisor mode, system mode, privileged mode)•Divide all instructions into two categories: unprivileged and privileged instructions•Users can’t execute privileged instructions•Users must ask the OS to do it on its behalf: system calls•The OS gains control upon a system call, switches to kernel mode, performs service, switches back to user mode, and gives control back to userApplicationStandard LibraryOperating SystemUser ModeKernel ModeCS12623-12 Randy WangInterrupt-Driven Operation•Everything the OS does is interrupt-driven•An interrupt stops the execution dead in its track, control is transferred to the OS•The OS saves the current execution context in memory. These include the PC, the registers, and other stuff (later)•The OS figures out what caused the interrupt•Executes a piece of code (interrupt handler) to handle this particular type of interrupt•Loads some execution context (possibly the one saved before the interrupt, or possibly some other saved one) and resumes executionInterrupts (cont.)CS12623-14 Randy WangInterrupt-Driven Operation (cont.)•Everything the OS does is interrupt-driven•System call: when user asks service from OS•When a device needs attention•(Periodic) timer interrupts•Program errors or “abnormal conditions”, such as illegal instructions or attempts of referencing illegal memory addresses•More examples which we will see later...CS12623-15 Randy WangClose Interaction Between Architecture and OS•The TOY architecture, as it is, is not sufficient to support even a minimum OS•Dual-mode operation and interrupts are a good example of how architects and OS writers must work together to build a working “system”•We will see more examples of this dialogueCS12623-16 Randy WangWhat Next?•What next?- Process management: a virtual CPU for every user, and indeed, every program- Memory management: infinite and safe memory for every program- File system: make files and directories out of disk blocks•What features are we shooting for for each of these?- Higher level (nicer) abstractions- Fairness- Protection- Sharing•What common strategies do we employ?- Chop up resources into small pieces and allocate them at this fine-grain


View Full Document

Princeton COS 126 - Lecture

Download Lecture
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?