Datorarkitektur och operativsystem U Unmesh h D. D Bordoloi B d l i The first electronic computers ENIAC J. Presper Eckert and John Mauchly at the Moore School of the University of Pennsylvania Funded by the United States Army B Became operational ti l d during i W World ld W War II but b t was nott publicly disclosed until 1946 ENIAC (Electronic Numerical Integrator and Calculator) – The world’s first electronic computer ENIAC Von Neumann ENIAC pro vided id d conditional di i l jumps j and d was programmable, clearly distinguishing it from earlier calculators In 1944 1944, JJohn hn von n Ne Neumann mann was as attracted to t the ENIAC project. r ject The group wanted to improve the way programs were entered and discussed storing programs as numbers; von Neumann helped crystallize the ideas p g a stored-program p g computer p called EDVAC and wrote a memo pproposing (Electronic Discrete Variable Automatic Computer). Programming was done manually by plugging cables and setting switches, and data was entered on punched cards. Programming g g for typical yp calculations required q from half an hour to a whole day Herman Goldstine distributed the memo and pput von Neumann’s name on it, much to the dismay of Eckert and Mauchly, whose names were omitted. This memo has served as the basis for the commonly used term von Neumann computer. Several early pioneers in the computer field believe that this term gives too much credit to von Neumann, Neumann who wrote up the ideas, and too little to the engineers, Eckert and Mauchly, who worked on the machines. ENIAC was a general-purpose machine, limited primarily by a small amount of storage and tedious programming For this reason, the term does not appear elsewhere in your textbook book. Technology Technology Electronics technology continues to evolve 18,000 vacuum tubes Increased capacity and performance Reduced cost 20 registers, each around 0.5 meters long 24 meters long long, 2.5 2 5 meters high Year Technology 1951 Vacuum tube 1965 Transistor 1975 I t Integrated t d circuit i it (IC) 1995 Very large scale IC (VLSI) 2005 Ultra large scale IC Relative performance/cost 1 35 900 2,400,000 6 200 000 000 6,200,000,000 Revolution ? H Human civilization i ili i : Agricultural revolution Industrial revolution … C Computers t are the th result lt off an iincredible dibl industry that embraces innovations at a b tht ki rate breathtaking t Yesterday’s Yesterday s fiction is now reality Applications empowered by computers: Human Human genome project World Wide Web Search Engines Social Social Networks A similar pace in Transportation industry would h have implied i li d that th t we reachh N New Y Yorkk iin ffew seconds Classes of Computers Classes of Computers Desktop computers General purpose, variety of software Subject to cost/performance tradeoff Server computers Network based High capacity, performance, reliability Range from small servers to building sized Embedded computers Hidden as components of systems Stringent power/performance/cost constraints Below your program Language of the hardware We constantly interact with these computers E.g., via apps on iPhone or via a Word Processor The hardware understands on or off. off Hence, the language of the hardware needs two symbols 0 and 1. 1 How is an application interact with the hardware? Commonly C l referred f d to as bi binary digits di i or bits. bi 2 letters do not limit what computers can do (just like the finite letters in our languages) (j g g ) Language of the hardware Instructions are collections of bits that the computer understands Hundreds/thousands/millions of lines of code are hidden hidd beneath b h our apps and d programs Hierarchical Layers y of Program g Code High-level language Level L l off abstraction b i closer l to problem domain Provides for productivity and portability Assemblyy language g g Textual representation of instructions What our programs instruct the computer to do are the instructions: Hardware representation Binary digits (bits) Encoded instructions and data Below your program • Application software – Written in high-level language • System software – Compiler: translates HLL code to machine code – Operating System: service code Under the Covers Understanding the underlying hardware (the computer!) is the main focus of this course So, what are the main components of the computer?? • Handling input/output • Managing memory and storage • Scheduling tasks & sharing resources • Hardware H d – Processor, memory, I/O controllers Components of a Computer Anatomy of a Computer Same components for allll kinds ki d off computer Desktop, server, embedded b dd d Output device Network cable Input Input device Input Input device Opening the Box Motherboard I/O connections Opening the Box Memory (DRAM) Random access memory Memoryy ((DRAM)) CPU or central processing unit A Safe Place for Data • Volatile main memory – Loses L iinstructions t ti and dd data t when h power offff • Non-volatile secondary memory – Magnetic disk – Flash memory – Optical p disk ((CDROM, DVD)) AMD Barcelona: 4 processor cores Abstractions Inside the Processor (CPU) Datapath: performs operations on data Control: sequences datapath, memory, ... Cache memory Small fast SRAM memory for immediate access to data Abstraction helps us deal with complexity Instruction set architecture (ISA) Instructions Arithmetic Th P The Processor Memory Input/Output The hardware/software interface Implementation Our Topics in this Course Note abstraction in both hardware and software ft Hide lower-level detail The details underlying and interface Performance Why is performance important? For purchasers: to choose between computers For F d designers: to make k the h sales l pitchh Defining performance is not straightforward! An A analogy l with i h airplanes i l shows h the h diffi difficulty l Defining Performance Which airplane has the best performance? Boeing 777 Boeing 777 Boeing 747 Boeing 747 BAC/Sud Concorde BAC/Sud Concorde Douglas DC-8-50 Douglas DC8-50 0 100 200 300 400 l laptop, the h one that h responds d faster f is the h better! b ! Boeing 777 Boeing 777 Boeing 747 Boeing 747 BAC/Sud Concorde BAC/Sud Concorde Douglas DC-8-50 Douglas DC8-50 500 1000 2000 4000 6000 Response time = How long it takes to do a task? 8000 10000 Cruising Range (miles) Passenger Capacity 0 Response time As a user of a smart phone (embedded computer), or 0 500 Response Time and Throughput 1500 Response time = the total time required for the computer 0 Cruising Speed (mph) to complete a task, including disk accesses, memory accesses, I/O activities, accesses activities operating system overheads overheads, CPU execution time … 100000 200000 300000 400000 Passengers x mph Response Time and Throughput Throughput If I am running a data center with several servers, faster computer is the one that completes several tasks in one day! Total work done per unit time • e.g., e g tasks/transactions/… tasks/transactions/ per hour Relative Performance Define Performance = 1/Execution Time Performancex > Performancey 1/Execution Time x > 1/Execution Time y Execution Time y > Execution Time x How are response time and throughput affected by Replacing R l i the h processor with i h a faster f version? i ? Adding more processors? Look L k in i the h textbook b k for f a discussion di i (P (Page 28) We’ll focus on response time for now… Performanc e X Performanc e Y Execution time Y Execution time X n Relative Performance Define Performance = 1/Execution Time “X is n time faster than Y” eY P f Performanc e X Performanc P f Execution time Y Execution time X n Example: time taken to run a program 10s on A, 15s on B Execution TimeB / Execution TimeA = 15s / 10s = 1.5 So A is 1.5 times faster than B CPU Time CPU Time CPU Clock Cycles Clock Cycle Time CPU Clock Cycles C Clock Rate Performance improved p byy Reducing number of clock cycles Increasing clock rate Measuring Execution Time Elapsed El d time i Total response time, including all aspects • Processing, P i I/O, I/O OS overhead, h d idle idl time i Determines system performance CPU time ti Time spent processing a given job • Discounts Di I/O time, i other h jobs’ j b ’ shares h Comprises user CPU time and system CPU time Different programs r rams are affected differentl differently by b CPU and system performance CPU Time Example Computer A: 2GHz clock, 10s CPU time Designing D i i C Computer B Aim for 6s CPU time Can do faster clock, clock but causes 1.2 1 2 × clock cycles How fast must Computer B clock be? CPU Time B CPU Clock CyclesB Clock RateB Hardware designer must often trade off clock rate against cycle l count Clock RateB Clock CyclesB 1.2 Clock Cycles A CPU Time B 6s CPU Time Example Computer A: 2GHz clock, 10s CPU time Designing Computer B We aim for 6s CPU time We W can do d faster f clock, l k but b causes 1.2 1 2 × clock l k cycles l How fast must Computer B clock be? CPU Time A CPU Clock CyclesA Clock RateA Clock CyclesA CPU Time A Clock Rate A 10s 2GHz 20 10 9 Instruction Count and CPI Clock Cycles Instruction Count Cycles per Instruction CPU Time Instruction Count CPI Clock Cycle Time Instruction Count CPI Clock Rate CPU Time Example Computer A: 2GHz clock, 10s CPU time Designing D i i C Computer B Aim for 6s CPU time Can do faster clock, clock but causes 1.2 1 2 × clock cycles How fast must Computer B clock be? CPU Time B Clock RateB Average cycles per instruction Determined by CPU hardware If different instructions have different CPI Average CPI affected by instruction mix Clock CyclesB 1.2 Clock Cycles A CPU Time B 6s 1.2 20 10 9 24 10 9 Clock RateB 4GHz 6s 6s CPI Example Computer A: Cycle Time = 250ps, CPI = 2.0 Computer C B: B Cycle C l Time Ti = 500ps, 500 CPI = 11.2 2 Same ISA Which is faster, and by how much? CPU Time Instruction Count for a program Determined by program, ISA and compiler CPU Clock CyclesB Clock RateB A CPU Time B Instruction Count CPI Cycle Time A A A is faster… I 2.0 250ps I 500ps Instruction Count CPI Cycle Time B B I 1.2 500ps I 600ps B I 600ps 1.2 CPU Time I 500ps A CPU Time …by this much Concluding Remarks Personnel Cost/performance is improving Unmesh BordoloiBordoloi Kursledare (examinator) Due to underlying technology development Kontorstider: • Vecka 37-43 - Tisdag 14-16 • Epost: unmesh.bordoloi@liu.se Hierarchical layers y of abstraction In both hardware and software Instruction set architecture The hardware/software interface Madeleine Häger Dahlqvist Kurssekreterare Execution E i time: i the h bbest performance f measure Power is a limitingg factor Email: madeline.hager.dahlqvist@liu.se Use parallelism to improve performance 42 42 Examination The course will have three obligatory exams/homework Homework 1 Homework 2 Final Exam Homework 1 This is obligatory and you can receive 0-4 points. The points will be added to the final grade. Homework 2 This is obligatory and you can receive 0-8 points. points The points will be added to the final grade. Final Exam There Th willll be b a ffinall written grade. d The Th points willll be b added dd d to the final grade 43 43 44 44 Examination Textbook Final score is calculated as the sum of The recommended textbook is: Homework 1(maximum ( 4 ppoints)) David A. Patterson and JJohn L. Hennessy: y Homework 2 (maximum 8 points) Computer Organization and Design - The Hardware / Software Interface,, 4th Edition,, Morgan Kaufmann Available as e-book in the university library Final Exam (maximalt 28 points) 45 45 Textbook Other literature William Stallings: Computer Organization and At the end of every lecture, there will be a p covered slide listingg the relevant portions from the textbook Architecture, Prentice Hall International, Inc.. Sven Eklund, Avancerad datorarkitektur, Studentlitteratur, 1994. Andrew S. Tanenbaum, Structured Computer Organization, 4th edition, Prentice Hall International, Inc., 1999. V. V C. C Hamacher, Hamacher et al.: al : Computer Organization, Organization 4th edition, McGraw-Hill, 1996. Today, we covered 1.1, 1.2, and 1.3 47 46 46 47 48 48