Computer Organization 2016 – 2015 1
26 Slides1.49 MB
Computer Organization 2016 - 2015 1
Instruction Set Architecture (ISA) Instruction Set Architecture (ISA), or simply Architecture, of a computer is the interface between the hardware and the lowest-level software ISA encompasses all the information necessary for programmers to write a machine language program that will run correctly, including instructions, registers, memory access, I/O devices, etc. ISA allows computer designers to talk about functions independently from the hardware that performs them 2
Instruction Set Architecture (ISA) (cont.) Application Binary Interface (ABI) is the combination of the basic instruction set and the OS interface provided for application programmers ABI is the user portion of the instruction set plus the OS interfaces used by application programmers Binary compatibility is extraordinarily important! It enables upgrading the computer without having to replace software 3
Interrupts Normal execution of programs may be interrupted if some device requires urgent servicing To deal with the situation immediately, the normal execution of the current program must be interrupted 4
Interrupts (cont.) Procedure of interrupt operation The device raises an interrupt signal The state of the processor is first saved before servicing the interrupt Normally, the contents of the PC, the general registers, and some control information are stored in memory The processor provides the requested service by executing an appropriate interrupt-service routine When the interrupt-service routine is completed, the state of the processor is restored so that the interrupted program may continue 5
Classes of Interrupts Program Generated by some condition that occurs as a result of an instruction execution such as arithmetic overflow, division by zero, attempt to execute an illegal machine instruction, or reference outside a user’s allowed memory space Timer Generated by a timer within the processor. This allows the operating system to perform certain functions on a regular basis 6
Classes of Interrupts (cont.) I/O Generated by an I/O controller, to signal normal completion of an operation or to signal a variety of error conditions Hardware failure Generated by a failure such as power failure or memory parity error 7
Performance 8
Introduction Performance is the key of the effectiveness of an entire system of hardware and software choosing among different computers based on their performance To improve the performance of a software system, we need to know: – what hardware factors contribute to overall system performance – the relative importance of these factors 9
Measuring Performance Program execution time is the measure of computer performance: – Also known as response time, elapsed time, or latency – It is the time between the start and completion of a task – Measured in seconds per program – The computer that performs the same amount of work in the least time is the fastest – Important for individual computer users 10
Measuring Performance (cont.) Throughput or bandwidth could also be used to measure performance: – It is the total amount of work done in a given time – Important for datacenter managers Decreasing execution time almost always improves throughput Changing either execution time or throughput often affects the other 11
Measuring Performance (cont.) CPU execution time (simply CPU time) the actual time the CPU spends computing a task’s lines of code does not include time spent waiting for I/O activities or running other programs 12
CPU Time CPU time can be further divided into: – User CPU time the CPU time spent in the program itself expresses CPU performance – System CPU time the CPU time spent in the OS performing tasks on behalf of the program 13
Exercise (1) Do the following changes to a computer system decrease response time, increase throughput, or both? Replacing the processor in a computer with a faster version Both response time and throughput are improved 14
Exercise (1) (cont.) Adding additional processors to a system that uses multiple processors for separate tasks, e.g., searching the WWW No one task gets work done faster Only throughput increases If demand for processing is as large as the throughput, the to queue up system might force requests In this case, increasing the throughput could also improve would reduce the waiting time in the queue response time, since it 15
Defining Performance To maximize performance, minimize response time or execution time for some task "X is n times faster than Y” means: 16
Exercise (2) If computer A runs a program in 10 seconds and computer B runs the same program in 15 seconds – How much faster is A than B? 17
Exercise (3) Computer C’s performance is 4 times faster than the performance of computer B, which runs a given application in 28 seconds – How long will computer C take to run that application? 18
Exercise (3) 19
Clock Cycle Clock cycles indicate when events take place in the hardware Instead of reporting execution time in seconds, we often use cycles We can count the number of CPU clock cycles for a program Clock rate (clock cycles per second in MHz or GHz) is inverse of clock cycle time (clock period) 20
Clock Cycle vs. Clock Rate 10 nsec clock cycle 100 MHz clock rate 5 nsec clock cycle 200 MHz clock rate 2 nsec clock cycle 500 MHz clock rate 1 nsec (10-9) clock cycle (109) clock rate 1 GHz 500 psec clock cycle clock rate 2 GHz 250 psec clock cycle 4 GHz 21
Clock Cycles Per Instruction Different instructions take different amounts of time depending on what they do: – Multiplication takes more time than addition – Floating point operations take longer than integer ones – Accessing memory takes more time than accessing registers Instructions can be divided into classes of similar instructions Instructions in the same class have the same Clock cycles Per Instruction (CPI) value 22
CPU Clock Cycle Total CPU clock cycles for a certain program can be calculated by looking at various instruction classes and their individual CPIs – CPIi is the clock cycles per instruction for class i (integer number), – Ci is the count of instructions executed from class i, and – n is the number of instruction classes 23
CPU Time The CPU time for a program can be expressed in two ways: 24
Exercise(4) A program runs on computer A with a 2 GHz clock in 10 seconds. What clock rate must a computer B run at to run this program in 6 seconds? Unfortunately, to accomplish this, computer B will require 1.2 times as many clock cycles as computer A to run the program. 25
Exercise(4) 26