Computer Organization: Instruction Set Architecture and Interrupts

undefined
C
o
m
p
u
t
e
r
 
O
r
g
a
n
i
z
a
t
i
o
n
2
0
1
5
 
-
 
2
0
1
6
1
I
n
s
t
r
u
c
t
i
o
n
 
S
e
t
 
A
r
c
h
i
t
e
c
t
u
r
e
 
(
I
S
A
)
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
I
n
s
t
r
u
c
t
i
o
n
 
S
e
t
 
A
r
c
h
i
t
e
c
t
u
r
e
 
(
I
S
A
)
 
(
c
o
n
t
.
)
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
I
n
t
e
r
r
u
p
t
s
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
I
n
t
e
r
r
u
p
t
s
 
(
c
o
n
t
.
)
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
C
l
a
s
s
e
s
 
o
f
 
I
n
t
e
r
r
u
p
t
s
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
C
l
a
s
s
e
s
 
o
f
 
I
n
t
e
r
r
u
p
t
s
 
(
c
o
n
t
.
)
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
P
e
r
f
o
r
m
a
n
c
e
8
I
n
t
r
o
d
u
c
t
i
o
n
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
M
e
a
s
u
r
i
n
g
 
P
e
r
f
o
r
m
a
n
c
e
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
10
M
e
a
s
u
r
i
n
g
 
P
e
r
f
o
r
m
a
n
c
e
 
(
c
o
n
t
.
)
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
11
M
e
a
s
u
r
i
n
g
 
P
e
r
f
o
r
m
a
n
c
e
 
(
c
o
n
t
.
)
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
12
C
P
U
 
T
i
m
e
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
13
E
x
e
r
c
i
s
e
 
(
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
14
E
x
e
r
c
i
s
e
 
(
1
)
 
(
c
o
n
t
.
)
 
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
 
system might force requests to queue up
 
• In this case, increasing the throughput could also improve
 
response time, since it would reduce the waiting time in the queue
15
15
D
e
f
i
n
i
n
g
 
P
e
r
f
o
r
m
a
n
c
e
16
16
E
x
e
r
c
i
s
e
 
(
2
)
17
17
E
x
e
r
c
i
s
e
 
(
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
18
E
x
e
r
c
i
s
e
 
(
3
)
19
19
C
l
o
c
k
 
C
y
c
l
e
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
20
C
l
o
c
k
 
C
y
c
l
e
 
v
s
.
 
C
l
o
c
k
 
R
a
t
e
 
          
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   =>  1 GHz (10
9
) clock rate
           500 psec clock cycle  =>   2 GHz clock rate
           250 psec clock cycle  =>   4 GHz clock rate
           200 psec clock cycle  =>   5 GHz clock rate
21
21
C
l
o
c
k
 
C
y
c
l
e
s
 
P
e
r
 
I
n
s
t
r
u
c
t
i
o
n
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
22
C
P
U
 
C
l
o
c
k
 
C
y
c
l
e
23
23
C
P
U
 
T
i
m
e
The CPU time for a program can be expressed in two ways:
24
24
E
x
e
r
c
i
s
e
(
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
25
E
x
e
r
c
i
s
e
(
4
)
26
26
Slide Note
Embed
Share

Explore the critical concepts of Computer Organization focusing on Instruction Set Architecture (ISA) and Interrupts. ISA serves as the interface between hardware and software, enabling programmers to write machine language programs effectively. Learn about Application Binary Interface (ABI), interrupts, and interrupt operations to enhance your understanding of computer systems.

  • Computer Organization
  • Instruction Set Architecture
  • Interrupts
  • Hardware Interface
  • Application Programming

Uploaded on Sep 22, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Computer Organization 2015 - 2016 1

  2. 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

  3. 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 upgrading the computer without having to replace software important! It enables 3

  4. 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

  5. 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

  6. 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

  7. 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

  8. Performance 8

  9. 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

  10. 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

  11. 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

  12. 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

  13. 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

  14. 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

  15. 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 system might force requests to queue up In this case, increasing the throughput could also improve response time, since it would reduce the waiting time in the queue 15

  16. Defining Performance To maximize performance, minimize response time or execution time for some task ? ??????????? = ????????? ???? "X is n times faster than Y means: ???????????? ???????????? =????????? ????? ????????? ????? = ? 16

  17. 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

  18. 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

  19. Exercise (3) 19

  20. 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

  21. 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 => 1 GHz (109) clock rate 500 psec clock cycle => 2 GHz clock rate 250 psec clock cycle => 4 GHz clock rate 200 psec clock cycle => 5 GHz clock rate 21

  22. 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

  23. 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

  24. CPU Time The CPU time for a program can be expressed in two ways: 24

  25. 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

  26. Exercise(4) 26

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#