Академический Документы
Профессиональный Документы
Культура Документы
1
Text-Books
William Stallings, “Computer Organization and Architecture –
Designing for Performance”, Ninth Edition.
2
Computer Architecture
The architecture is concerned with the attributes (structure and behaviour) of the
computer visible to the programmer
Instruction Set
Instruction Formats
Specific Registers and their roles
Number of bits used for data representation
I/O mechanisms
Addressing techniques.
e.g. Is there a multiply instruction?
Architecture-An Application
interface Programs
between
software and
System
hardware.
Programs
Architecture
Organization
Computer Design
❑ It is a device that
❑ Accepts input
❑ Executes instructions
❑ Returns results.
6
Computer
❑ It consists of following components
❑ Central Processing Unit
❑ Input
❑ Output
❑ Storage
7
Stored-Program Computer
A stored-program computer is a computer that stores program instructions in
electronic memory.
This contrasts with machines where the program instructions are stored
on plug-boards /punched card/similar mechanisms.
Plug-boards
8
Stored-Program Computer
Stored-Program Computers
Von-Neumann architecture
A computer which stores a program data and instruction in
the same memory.
Harvard architecture
A computer which has separate memories for storing
program and data.
9
Von-Neumann Architecture
• Hungarian-American mathematician John von Neumann.
• A computer which stores a program data and instruction data in the
same memory.
• The programs are executed in sequential manner.
• The sequential execution is maintained by special register (Program
Counter)
1
0
Von-Neumann Bottleneck
There exists a single data path between the CPU and main memory.
Due to shared bus, an instruction fetch and a data operation cannot
occur at the same time thus leading to performance slowdown.
This is known as von Neumann bottleneck.
1
1
Components of a Computer
Monitor Speaker
(output) (output) System unit
(processor, memory…)
Printer
(output)
Storage devices
(CD-RW, Floppy, Hard
disk, zip,…)
Mouse
(input)
Scanner Keyboard
(input) (input)
1
2
Central Processing Unit (CPU)
➢ The CPU, the brain of the computer.
➢ Also known as microprocessor: Housed on a tiny silicon chip
1
3
Arithmetic logic Unit
Performs arithmetic computations and logical operations; by
combining these two operations the ALU can execute complex
tasks.
Arithmetic operations include addition, subtractions,
multiplication, and division.
Logical operations involve comparisons.
14
Control Unit
It is the “boss” and coordinates all of the CPU’s activities.
Uses programming instructions.
It controls the flow of information through the processor by
controlling what happens inside the processor.
Send control signal to all associated units.
15
Input Devices
➢ The input devices are operated and controlled by the control unit
(CU).
16
Input Devices
17
Output Unit
After the data has been processed, the results are sent in the form
of useful information to output units.
The input devices are operated and controlled by the control unit
(CU).
18
Computer Output Devices
Monitor: screen that display Speakers: allow you to
information such as text, hear voice, music, and
numbers, and pictures- other sounds from your
softcopy. computer.
19
Memory
Two Types
Short term : Random Access Memory (RAM)
Long term : Read Only Memory (ROM)
20
Random Access Memory (RAM)
21
Read Only Memory (ROM)
• Most common is the BIOS ROM; where the computer uses instructions
contained on this chip to boot or start the system when you turn on your
computer.
22
Applications of Computers
Accounts
Games
Education
Research
On-line banking
Smart ID cards
Supermarkets
Working from home (Tele-working)
Internet
23
Concept of Programming
Programming Terminology
➢ Instruction: An instruction is an order given to the CPU to
perform a unit of task. (Add, Subtract, Load, Move, etc.)
➢ Note:
➢ When you have written a program, the computer will
behave exactly as you have instructed it.
➢ It will do no more or no less than what is contained in your
instructions.
25
Why Programming (ML/AL/HLL)?
How humans interact with each other?
Using a language , the basic elements of a language are the letters,
right?
26
Historical Background
➢ As early practice of rewiring circuits proved too cumbersome,
computer languages began to appear in order to control the
computer.
27
Historical Background
Once systems such as UNIVAC became available in early 1950s,
assembly language was used to simplify entering binary code.
28
Historical Background
As assembly language is also tedious for business person, therefore,
many high-level programming language has been developed
FLOWMATIC.
29
Programming Language
30
Low-Level Language
➢ Low-level languages are referred to as 'low' because they are
very close to how different hardware elements of a
computer actually communicate with each other.
31
Machine Language
➢ It is the native language that the CPU “speaks” and
“understands”.
32
Assembly Language
➢ A first step to improve programming structure to make
machine language more readable by humans.
➢ For example, the machine code for adding two integers might be:
01000001 00111010 00111101
01000001 00101011 01000010
01000011 00111010
01000111 00111110
35
High Level Languages
A programming language
uses words and symbols to make it relatively easy to read
and write a computer program by human.
In a high-level language
NO one-to-one correspondence between Instructions of HLL
to Machine Language.
One statement in a HLL may correspond to many
microprocessor instructions.
36
Comparing ML/AL/HLL (Addition of Two numbers)
➢ For example, the machine code for adding two integers might be:
01000001 00111010 00111101
01000001 00101011 01000010
01000011 00111010
01000111 00111110
38
Translation
➢ Source code: A program written in a high-level
language.
39
Compilers
➢ A compiler makes the translation once so that the source code don’t
have to be translated each time the program is run.
40
Interpreters
➢ An interpreter is a program that translates the source code of a
high-level language into machine language.
➢ Every time the program is run, the interpreter must translate each
instruction again.
41
Some Terminologies
42
Program v/s Process
Program v/s Process
A program is a set of instructions written to complete the specific job on
your computer.
For example, Google browser chrome.exe is an executable file which
stores a set of instructions written in it which allow you to view web
pages.
Programs are never stored on the primary memory in your computer.
Instead, they are stored on a disk or secondary memory.
Program v/s Process
A process is an execution of any specific program.
It is considered an active entity that performs the purpose of the
application.
Multiple processes may be related to the same program.
For example
If you are double click on your Google Chrome browser icon on your PC
or laptop, you start a process which will run the Google Chrome
program.
When you open another instance of Chrome, you are essentially
creating a two process.
Uni-Processor
A computer system with a single central processing unit
that is known as uni-processor.
System Bus
➢ Control Unit
➢ Arithmetic & Logic Unit
➢ Registers
➢ Clock
➢ And, of course, wires that connect everything
together.
Control unit
➢ It is the “boss” and coordinates all of the CPU’s activities.
➢ The circuitry that controls the flow of information through the processor, and
coordinates the activities of the other units within it.
➢ In a way, it is the "brain within the brain", as it controls what happens inside
the processor, which in turn controls the rest of the system.
Control unit
The faster the clock, the more instructions the CPU can
execute per second.
Two Types
Long term / Read Only Memory (ROM)/Non-volatile Memory
It stores information permanently
➢ Read-only memory is useful for storing software that is rarely changed during
the life of the system, sometimes known as firmware.
71
Random Access Memory (RAM)
• Also known as the main memory/primary memory
• It can be used to read and changed in any order
• It is typically used to store working data/machine code
• It is volatile
72
Random Access Memory (RAM)
Two Types
• Static RAM (SRAM)
• Typically used for CPU cache
73
Main Memory
How memory is used?
When a program such as your Internet Explorer(IE) is clicked
to open.
The program of IE is loaded from your hard drive and placed
into RAM.
The program now becomes process.
This process now communicates with the processor at higher
speeds (than hard disk).
Communication
➢ Data and instructions need to get into the system and
results out
➢ Input/output
➢ Often grouped
➢ A number of channels in one bus
➢ 32 bit data bus is 32 separate single bit channels
System Bus?
➢ A system bus is a composite bus that connects the
major components of a computer system.
Address bus
ALU Register Set
Data bus
Control bus
Address bus
➢ Uni-directional Bus
PROCESSOR
Storage
KEYBOARD
devices
PRINTER
88
Basic Operational Concept
Input
Process/Manipulate
Output
Storage
Store Data 89
Basic Operational Concept
The model executes instructions sequentially.
To execute a program, the CPU “reads” each
instruction SEQUETIALLY and “executes” it.
Fetch
At the beginning of each instruction, the CPU presents the value
of the program counter on the address bus.
The CPU then fetches the instruction from main memory via
the data bus into the instruction register.
91
Basic Operational Concept
Decode
The data in instruction register is decoded by control unit.
Execute
The control unit sends a sequence of control signals to the
relevant functional units of the CPU to perform the actions
required by the instruction such as read/Write/Arithmetic
operation/others.
92
Top Level View of Computer
Program Execution
➢ In any program, all instructions are executed sequentially.
➢ Processor-memory
➢ Data transfer between CPU and main memory
➢ Processor-I/O
➢ Data transfer between CPU and I/O module
➢ Data processing
➢ Some arithmetic or logical operation on data
➢ Control
➢ Alteration of sequence of operations
➢ e.g. jump
Program Execution: An example
Assumptions
Program to execute
Add two numbers stored at address 940h and 941h.
Store the result at location 941h.
Program Execution: An example
1st
Instruction:
Fetch Cycle
Program Execution: An example
• 1940h - Load
Accumulator Register
from the value stored
at memory location
940
Program Execution: An example
2nd Instruction:
Fetch Cycle
Program Execution: An example
2nd Instruction:
Decode and Execute
5941h- Add to
Accumulator Register
the value stored at
memory location
941h
Program Execution: An example
3rd Instruction
Fetch Cycle
Program Execution: An example
3rd Instruction
-Decode and Execute
0010
(2h) - Store AC to
memory
An interrupt
A signal from a device attached to a computer or from a program
within the computer
Requires the operating system to stop and figure out what to do next.
➢ If interrupt pending:
➢ Suspend execution of current program
➢ Save context
➢ Set PC to start address of interrupt handler routine
➢ Process interrupt
➢ Restore context and continue interrupted program
Instruction Cycle with Interrupts
Transfer of Control via Interrupts
Benefits of Interrupt Handling
Benefits of Interrupt Handling
Short I/O Wait
Benefits of Interrupt Handling
Benefits of Interrupt Handling-Long I/O Wait
Instruction Cycle (with Interrupt stage)
State Diagram
Interrupts
An operating system usually has some code that is called an interrupt
handler.
Software interrupts
It occurs when an application program terminates
abruptly or requests certain services from the
operating system.
Interrupts
Multiple Interrupts
Two approaches to deal with multiple interrupts
Sequential or Disable interrupts
Nested or Priority Based
Multiple Interrupts
Sequential
The processor can and will ignore that interrupt request signal
while processing one interrupt.
Interrupts remain pending and are checked after current
interrupt has been processed.
Interrupts handled in sequence as they occur.
Disadvantage
High priority or time-critical tasks may be ignored.
Multiple Interrupts- Sequential
Multiple Interrupts
Nested
Low priority interrupts can be interrupted by higher priority
interrupts
When higher priority interrupt has been processed, processor
returns to previous interrupt
Multiple Interrupts – Nested
Time Sequence of Multiple Interrupts
Disk
interrupt
occurs at
t=20.
THANK YOU