Today’s topics Performance

 Performance  Performance = 1/Time  Notes from David A. Patterson and John L. Hennessy,  The goal for all software and hardware developers is to increase Computer Organization and Design: The performance Hardware/Software Interface, Morgan Kaufmann, 1997.  Metrics for measuring performance (pros/cons?) Elapsed time  Operating Systems   CPU time  Brookshear: Chapter 3 • Instruction count (RISC vx. CISC)  Notes from Kevin Wayne’s COS 126 course at Princeton • Clock cycles per instruction  Upcoming • Clock cycle time  Security  MIPS vs. MFLOPS • GI, 11 & Brookshear 3.7  Throughput (tasks/time)  Other more subjective metrics?  What kind of workload to be used?  Applications, kernels and benchmarks (toy or synthetic)

CPS 001 10.1 CPS 001 10.2

What is an ? What is an Operating System?

Quotes from trial. Jim Allchin [Microsoft witness] :

■ "A computer operating system, like any other type of software, Dave Farber [DOJ witness]: is a set of instructions that causes a computer to carry out

■ "An Operating System is software that controls the specified functions. Although no clear line of demarcation execution of programs on computer systems and may exists between the functions performed by operating system provide low-level services such as resource allocation, software and other types of software, operating systems scheduling and input-output control in a form which is generally serve, at a bare minimum, as the computer’s 'central sufficiently simple and general so that these services are nervous system,' scheduling the execution of tasks by the broadly useful to software developers." central processing unit and controlling the flow of information within the computer and between the computer and any peripheral devices that may be attached to it. It is important to Ed Felten [DOJ witness]: bear in mind that all software is a series of instructions to a ■ "An operating system is software that provides services computer, and terms that have evolved to categorize such relating to booting the machine and starting programs, software are merely descriptive of general categories of interfacing with the hardware, managing and scheduling functionality. There is no widely accepted definition of an use of hardware resources, and basic security services." operating system; it is a concept that has evolved over time based on what is technically possible and what customer[s] have said they want."

2 3 What is an Operating System? What is an Operating System?

Judge Jackson’s ruling: Modern operating systems support:

■ "An ’operating system’ is a software program that controls the ■ Software tools for creating programs allocation and use of computer resources (such as central – libraries, compilers processing unit time, main memory space, disk space, and ■ Running multiple programs. input/output channels). The operating system supports the – multiprogramming functions of software programs, called ’applications,’ that perform ■ Saving/accessing data. specific user-oriented tasks." – files, virtual memory

■ User interaction. – window system

■ Interaction with other systems. – networking

■ Core applications programs. – client-server

4 5

What is an Operating System? Multiprogramming

Execution Control. Operating system "kernel" keeps track of several programs.

■ OS keeps track of state of CPU, devices. ■ CPU does 1 thing at a time.

■ Goal: illusion of multiple machines. External Devices.

■ Display, keyboard, mouse, disks, CD, network. INTERRUPT:

■ Part of hardware of real machines Virtual Machines. – stop

■ Pretend machines that each person/program can use. – save Program Counter (PC) somewhere "special"

■ OS implements abstract devices. – change PC

! Simpler for user than real hardware. ■ Necessary to manage input-output devices. ! Easier to change to new hardware. – mouse click, keyboard

■ OS allows several programs/processes to "share" CPU by keeping table of "current" PC’s for programs setting clock to interrupt periodically. – Context switching – round-robin or user priorities

6 7 Virtual Memory Size of Virtual Memory

Problem 1: several programs need to share same memory. How many bits is enough?

■ Direct solution: apportion up the memory. ■ 16 bits is not enough.

■ 32 bits is not enough.

Problem 2: program needs more memory than machine has. ■ 64 bits? 64 19 ■ Direct solution: "overlays." – 2 = 18,446,744,073,709,551,616 > 10 addresses

– program shuffles its own data in and out of memory to disk ■ 512 certainly enough. ! Nightmare for programmers. ! No need for relocation, use a galactic address dispenser.

It’s all just memory, why should file system look more complicated? Some big numbers. 70 ■ 2 : number of grains of sand on beach at Coney Island. 93 "Better" solution: VIRTUAL MEMORY (1960’s). ■ 2 : number of oxygen atoms in a thimble.

■ 256 All programs assume access to all memory. ■ 2 : number of electrons in the universe.

■ Each program actually uses a small portion. More sophisticated paging strategies needed.

9 11

Paging Window Manager

Each page brought in has to REPLACE another. Virtual Terminals.

■ Page replacement strategies. ■ Each program has its own virtual display.

– Ex. least recently used ■ Ex. X-terminal: complex, customizable, virtual!

■ Still being studied, invented. ■ Just another simulation program.

■ Commonplace today, rare in 1985 Basic principles. ■ Ingenious design meets accelerating technology.

■ MEMORY HIERARCHY – local: fast, small, expensive History. – remote: slow, huge, cheap ■ Xerox PARC (Alto), Macintosh, Windows NT, X-terminal, .

■ Tradeoff speed for cost.

■ CACHE recently accessed information. Problem or opportunity? ! Program thinks it has fast *and* huge memory. ■ Truly "virtual."

■ Moving away from grounding in reality. – harder for programmers to understand what is happening

■ Flexibility vs. standardization.

■ Other ways of interacting with computer?

13 14 Client-Server Model The Network

System divided into two distinct parts. "Ultimate" distributed system. ROUTERS

■ Ex: display server (implement virtual display). ■ Move packets across network. – draw stuff on screen INTERNET

– monitor keyboard and mouse input ■ "All the cooperating networks." TCP: Transmission control protocol.

■ Ex: Client (use virtual display). ■ Break big messages into packets.

– applications programs Circuit switched network ■ Collect received packets into

■ Phone system. messages.

Server is interface between client program and display hardware. Packet switched network ■ Check for errors.

■ Network system. Model generalizes beyond display management. Domain Name System.

■ Client: request service. IP: Internet protocol. ■ Distribute authority/responsibility

■ Server: do the work. ■ Packet. for name service.

– 1-1500 bytes ■ Can use "www.duke.edu" Advantages. – from address instead of 152.3.233.7.

■ Single server can handle multiple clients. – to address

■ Keeps kernel simple, adaptable. ■ Address. (many details omitted!)

■ Smooth transition to DISTRIBUTED SYSTEM. – Ex. 152.3.140.129 15 16

Operating System / Network Issues Unix File System Layout

Network applications. Current network ethics: Goal: provide simple abstraction File. (sequence of bytes) for user ■ Communication (mail, news). ■ Honor and foster individualism. ■ List of data blocks. programs. ■ Remote login (telnet). ■ Network is good and must be

■ File transfer (ftp, Napster, Gnutella). preserved. Directory. Each disk has: ■ ■ Publishing (html). List of file names. ■ I-nodes (one per file). Should hackers or the government ■ ■ Browsing (Netscape, IE). i-node addresses "run" the net? – indexing information ■ E-commerce. – pointers to disk blocks ■ Can commercial apps trust an Forms a TREE structure. "open net"? ■ Data blocks. Modern rendition of ancient tradeoffs. ■ Traverse the tree for ■ – just data Does a "closed net" violate sequential access. ■ Personal computer or Network individual rights? computer. Superblock (block 1).

■ ONE huge virtual machine?!? Security/Privacy/Copyright. ■ Catalog of disk layout.

■ Size and number of data Compare/contrast. Who owns? Who pays? blocks.

■ Computer center, phone system, ■ Size and number of i-nodes. Post office (snail mail), Libraries. ■ Free list of data blocks.

17 18