Computer Architecture and Operating System

Download Report

Transcript Computer Architecture and Operating System

Text Reference: Warford
1
Computer Architecture:
The design of those aspects of a
computer which are visible to the
programmer.
Architecture
Instruction Set
Registers
Memory
Organization
2
Digital Computer:
“…machine that accepts digitized input
information, processes it according to a list of
internally stored instructions, and produces the
resulting output information.
The list of instructions is called a computer program
and the internal storage is called computer
memory.”
from: Computer Organization 4th Edition
Hamacher, Banesic, Zaky
McGraw Hill, 1996.
3
Computer
Work
Flow
instruction flow
Processing
Input
Output
data flow
analysis
Input
Processing
?
design
Input
?
Output
4
Computer Main Elements
Central
Processing
Unit (CPU)
Memory
Input/Output
System Bus
5
Computer Instruction Set
Individual instructions are very simple:
– add two numbers
– move a piece of data from one location to
another
– compare two numbers
The only representation of instructions and data
that a computer can understand is BINARY
(values of 1 and 0 only).
6
Sample machine language instruction:
(ADD contents of Register B to contents of
Register A)
0000011 11000011
Sample Data:
(the character “B”, also the number 66)
01000010
Problem: Binary representation of instructions
and data are not easily generated,
manipulated, or understood by humans.
7
Solution:
– design a new set of instructions (L2) more
convenient to use by humans than native
(L1) machine instructions.
L1 Instruction:
11000011
Equivalent L2 Instruction:
00000011
ADD A, B
– How can a program written in L2 be
executed?
8
Translation
L2 program
(ADD A, B)
Translator Program
L1 program
(00000011 11000011)
(00000011 11000011)
9
Interpretation
L2 program
(ADD A, B)
Interpreter Program
(L2 Virtual Machine)
(00000011 11000011)
10
Digital Computer as a Multilevel Machine
Applications Level
Translation (Compiler)
Assembly Language Level
Machine code
Operating System Level
Machine code
Translation (Assembler)
Software
High Level Language Level
Partial Interpretation,
Partial Pass-through
Interpretation (microprogram)
Microprogram Level
Directly executed by hardware
Hardware
Machine Language Level
Digital Logic Level
11
Digital Logic Level
“gate” level logic circuits. Primitive
“computations” confined to
Boolean operations (AND, OR,
NOT)
no concept of a program at this
level. There is simply a sequence
of instructions to be processed.
12
Microprogramming Level
machine language instruction
interpreted. - causes a series of
simpler instructions to be executed
by underlying digital logic level.
Microprogram for each instruction
stored permanently in memory
internal to the microprocessor when
it is manufactured.
13
Microprogram level example:
Machine language level instruction:
00000011 11000011
Microprogram:
1. Fetch instruction from memory
2. Increment Program Counter in preparation for the
next instruction. (the Program Counter is a register
that indicates where the next instruction to be
executed is stored in memory)
3. Route contents of Register B and Register A to
Arithmetic Logic Unit (ALU) input.
4. ADD the two inputs to the ALU generating a result.
5. Store result in Register A.
14
Machine Language Level
this level defines the interface
between the inner workings of the
processor and the outside world.
Every model of processor has a
unique set of instructions (ISA:
Instruction Set Architecture) and
encoded instruction formats.
15
Operating System Level
an Operating System is a program that provides an
environment in which a user can execute other programs in
a convenient and efficient manner.
It is responsible for managing system resources (in time
and space), allocating resources to user programs, and
monitoring the integrity of the computer system.
It provides services to programs in order to make the
programming task easier. These services can be invoked by
the user program through “system calls”.
Most of the code generated by upper levels is passed
directly to the machine language level.
16
Assembly Language Level
assembly language is a symbolic representation of the
machine language level.
The programmer must still be aware of the internal
architecture of the target machine.
In general, there is a 1-to-1 mapping between an assembly
language statement and a machine language statement.
Example PC machine language instruction: 00000011
11000011
Equivalent PC Assembly Language instruction:
ADD
AX, BX
(adds the contents of processor register “AX” to contents
of processor register “BX” and stores the result in AX)
17
High Level Language Level
Hides the low level architectural
details from the programmer.
High level languages are generally
machine (architecture)
independent.
Provides language constructs for
specifying and manipulating
complex data structures.
Supports a variety of programming
styles (i.e. linear, object oriented)
18
High Level Language Level
– Pascal, C, C++,Fortran, Java (compiled)
– Perl, Python, JavaScript, Java
(interpreted)
– Hides the low level architectural details
from the programmer.
– High level languages are generally machine
(architecture) independent.
Example code to add two numbers together:
int value1, value2;
value1 = value1 + value2;
19