Foundations of Sequential Programs New
Foundations of Sequential Programs New
SEQUENTIAL
PROGRAMS
Lecturers:
Dr. N. A. Azeez, Dr. R. A. Koleoso, and Mr S. E. Edagbami
Other Lecture Infomation
Main memory - data store that can be directly addressed by the CPU
Main memory is used to store program instruction and data, using the System
Bus to communicate with CPU. Main memory is often created using Random
Access Memory (or RAM) or Read Only Memory (ROM).
RAM - Random Access Memory can be read from and written to. Data is cleared
when the power is off
ROM - Read Only Memory can only be read from, data is maintained when the
power is off
The two main types of main memory are ROM and RAM. Whilst RAM might be
several gigabytes in size, ROM will often be a few kilobytes.
SYSTEM BUS
A Bus is a connection between different devices. This connection will normally
consist of multiple wires along which signals, instructions and data will be carried. In
Von Neumann Architecture there is a single bus to manage the connection between
the three main components. The System Bus consists of 3 separate buses, each with
a specific task that you need to know.
Address Bus: A single-directional bus that carries address signals from the CPU
to Main Memory and I/O devices. This might involve the CPU requesting some data
from Main Memory, sending the address of the data to Main Memory, then Main
Memory returning the data along the data bus. Let's take a look at some code:
LDA 23
BUS cont……..
Data bus: A bi-directional bus, typically consisting of 32 wires, used to transport
data and instructions between the three components of the three-box model. The
larger the Data Bus the more data can be transported at one time. For example if
we have an 8 bit Data Bus, the maximum value we could send along the Bus would
be: 1111 1111 = 255
Control bus: A bi-directional bus, typically consisting of more than 16 wires, used to
transport control signals between the three components of the three-box model.
The control bus is used to carry important information such as messages to say
when a device has finished a job or when a device has just been plugged in.
FLYNN’S CLASSIFICATION OF
COMPUTER ARCHITECTURES
Michael Flynn introduced a classification of various computer architectures
based on notions of instruction and data stream. The number of instruction is
given as either Single instruction (SI) or multiple instruction(MI) and the
numbers of data given as either single data(SD) or multiple data(MD).
Machine can be classified as
I. SINGLE INSTRUCTION SINGLE DATA (SISD)
II. MULTIPLE INSTRUCTION SINGLE DATA ( MISI)
III. SINGLE INSTRUCTION MULTIPLE DATA (SIMD)
IV. MULTIPLE INSTRUCTION MULTIPLE DATA (MIMD)
CONT…….
Interpreter
An interpreter program executes other programs directly, running through
program code and executing it line-by-line. As it analyses every line, an
interpreter is slower than running compiled code but it can take less time to
interpret program code than to compile and then run it.
Compiler
A Compiler is a computer program that translates code written in a high l e v e l
language to a lower level language, object/machine code. The most co m m o n
reason for translating source code is to create an executable p r o g r a m
(converting from a high level language into machine language).
WHAT IS A LOADER
In computing, a loader is the part of an operating system that is responsible
for loading programs and libraries. It is one of the essential stages in the
process of starting a program, as it places programs into memory and
prepares them for execution. Loading a program involves reading the
contents of the executable f ile containing the program instructions into
memory, and then carrying out other required preparatory tasks to prepare
the executable for running. Once loading is complete, the operating system
starts the program by passing control to the loaded program code.
DATA REPRESENTATION
How is information represented in a computer? It is in the form of a binary digit
popularly called bit. But how are the arithmetical calculations performed through
these bits? How then are words like ABCD stored in the computer?
Number Systems
A number system of base (also called radix) r is a system which has r distinct
symbols for r digits. A string of these symbolic digits represents a number. To
determine the quantity that the number represents, we multiply the number by
an integer power of r depending on the place in which it is located and then f ind
the sum of weighted digits.
NUMBER SYSTEM…..
Decimal Numbers: The decimal number system has ten digits represented by
0,1,2,3,4,5,6,7,8 and 9. Any decimal number can be represented as a string of
these digits and since there are ten decimal digits, therefore, the base or radix of
this system is 10.
Binary Numbers: In binary numbers we have two digits 0 and 1 and they can
also be represented, as a string of these two-digits called bits. The base of the
binary number system is 2.
Octal Numbers: An octal system has eight digit represented as 0, 1, 2, 3, 4, 5, 6, 7.
For finding the equivalent decimal number of an octal number one has to find
the quantity of the octal number, which is again calculated as:
Octal number (23.4)8
Hexadecimal Numbers: The hexadecimal system has 16 digits, which are
represented as 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. A number (F2)H is
equivalent to F x 161 + 2 x 160 = (15 x 16) + 2
Computational Data Representation
The computer is a discrete digital device and it stores information in flip-flops
which are two state devices, in binary form. Basic requirements of
computational data representation in binary form are:
Representation of sign;
Representation of magnitude;
If the number is fractional, then binary or decimal point, and exponent
sign can be either positive or negative, therefore, one bit can be used to
represent a sign. By default it should be the leftmost bit. n bit can be
represented as n+1 bit number, where n+1th bit is the sign bit and the rest n bits
represent its magnitude
1 bit n bits
sign Magntitude
Complement
Complement: There are two types of complements for a number of base r;
these are called r’s complement and (r- 1)’s complement. For example, for
decimal numbers the base is 10, therefore, complements will be 10’s
complement and (10-1) = 9’s complements. For binary numbers we talk about
2’s and 1’s complements. But how are we to obtain complements and what do
these complements mean? Let us discuss these issues with the help of
following example:
Example 1: Find the 9’s complement and 10’s complement for the decimal
number 256.
9’s complement of 256 = 9 9 9
-2 -5 -6
= 7 4 3
10’s complement: adding 1 in the 9’s complement produces the 10’s
complement:
10’s complement of 256 = 743 + 1 = 744
Example 3: Find 1’s and 2’s complement of 1010
1 1 1 1
-1 -0 -1 -0
0 1 0 1
The number is 1 0 1 0
The 1’s complement is 0 1 0 1
Negative Numbers
How to represent -1, -2, … on a computer?