COMPUTER ORGANIZATION & ARCHITECTURE
Computer Organization and Architecture
Module 1 Part 1
Basic Structure of Computers
Computer Organization and Architecture consists of -
Computer hardware to store and process the information has electronic circuits,
displays, magnetic and optical storage media, electro-mechanical equipment, and
communication facilities.
Computer Architecture instructions encompass specification of an instruction
set along with hardware units to implement the instructions.
Computer Types:
• A contemporary computer is a fast electronic calculating 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.
Types of Computers:
Many types of computers exist that differ widely in size, cost, computational power, and
intended use.
1. Desktop Computers:
• The most common form of desktop computer is Personal computer, which has
found wide use in homes, schools, and business offices.
• Desktop computers have processing and storage units, visual display and audio
output units, and a keyboard.
• The storage media include hard disk, CD-ROMs, and the diskettes.
• Portable notebook computers (laptops) are a compact version of the personal
SAVITA M, DEPT OF E&CE 1
COMPUTER ORGANIZATION & ARCHITECTURE
computers with all of these components packaged into a single unit.
2. Workstations:
• They have high resolution graphics input/output capability and significantly
more computational power than personal computers.
• They are often used in engineering applications, especially for interactive design
work.
3. Enterprise Systems:
• Enterprise systems or mainframes are used for business data processing in
medium to large corporations that require much more computing power and
storage capacity than workstation can provide.
4. Servers:
• Servers contain sizable database storage unit and are capable of handling large
volumes of requests to access the data.
• In many cases, servers are widely accessible to the education, business and
personal user communities.
• The requests and responses are usually transported over Internet communication
facilities.
5. Supercomputers:
• They are used for large scale numerical calculations required in applications
such as weather forecasting and aircraft design and simulation.
Functional Units:
A computer consists of five functionally independent main parts:
1. Input unit
2. Memory input
3. Arithmetic and logic units
4. Output unit
5. Control units
SAVITA M, DEPT OF E&CE 2
COMPUTER ORGANIZATION & ARCHITECTURE
• The input unit accepts coded information from human operators, from electromechanical
devices such as keyboards, or from other computers over digital communication lines.
• The information received is either stored in the computer’s memory for later reference or
immediately used by the arithmetic and logic circuitry to perform the desired operations.
• The processing steps are determined by a program stored in the memory.
• The results are sent back to the outside world through the output unit.
• All of these actions are coordinated by the control unit.
• The arithmetic and logic unit and control unit is together called as Processor and input and
output equipment is called as input-output (I/O) unit.
• The information handled by a computer is categorized as either instruction or data.
• Instructions or machine instructions are commands that
• Govern the transfer of information within a computer as well as between the
computer and its I/O devices.
• Specify the arithmetic and logic operations to be performed.
• A list of instructions that performs a task is called a program.
• Usually the program is stored in the memory.
• The processor then fetches the instructions that make up the program from the memory,
one after another, and performs the desired operations.
• Almost all of the actions of the computer are controlled by the stored program.
• Data are numbers and encoded characters that are used as operands by the instructions.
• Data can also be any digital information.
SAVITA M, DEPT OF E&CE 3
COMPUTER ORGANIZATION & ARCHITECTURE
• Even the entire program can be called as data, if it is used by another program.
• For example, compiler converts source program (HLL) to object program (MLL).
• The source program is the input data to the compiler program which translates source
program into a machine language program.
• Information handled by the computer must be encoded in suitable format.
• Each number, character or instruction is encoded as a string of binary digits called bits
having two possible values 0 or 1.
• Formats used to represent the bits:
1. Binary Coded Decimal (BCD) – uses 4 bits to represent a decimal digit.
Ex: 3 – 0011, 10 – 1010
2. American Standard Code for Information Interchange (ASCII) – uses 7 bits.
Ex: A –> 1000001, a –> 1100001, 5 –> 0110101, % -> 0100110
1 –> 0110001, space –> 0100000, = -> 0111101, / -> 1011100
3. Extended Binary Coded Decimal Interchange Code (EBCDIC) – uses 8 bits.
Ex: a -> 10000010, 3 -> 11110011, # -> 01111011, . (dot)-> 01001011
Input unit
● Computers accept coded information through input units, which read the data.
● The most well-known input device is the keyboard.
● Whenever a key is pressed, the corresponding letter or digit is automatically translated
into its corresponding binary code and transmitted over a cable to either the memory or
the processor.
● Other input devices available: Joysticks, trackballs, mouses and microphones.
Memory Unit
● The function of the memory unit is to store programs and data.
● There are two classes of storage, called primary and secondary.
● Primary Memory, also called main memory, is a fast memory that operates at electronic
speeds.
● Programs must be stored in this memory while they are being executed.
● Memory consists of a large number of semiconductor storage cells, each capable of
SAVITA M, DEPT OF E&CE 4
COMPUTER ORGANIZATION & ARCHITECTURE
storing one bit of information.
● They are handled in groups of fixed size called words. The memory is organized so that
one word can be stored or retrieved in one basic operation.
● To provide easy access to any word in the memory, a distinct address is associated with
each word location.
● A given word is accessed by specifying its address and issuing a control command that
starts the storage or retrieval process.
● The number of bits in each word is referred to as the word length of the computer,
typically 16, 32, or 64 bits.
● Instructions and data can be written into or read from the memory under the control of
the processor.
● A memory in which any location can be accessed in a short and fixed amount of time,
few nanoseconds (ns) to about 100 ns after specifying its address is called a random-
access memory (RAM).
● Memory access time: The time required to access one word.
● The memory of a computer is normally is implemented as a memory hierarchy of three
or four levels of semiconductor RAM units with different speeds and sizes.
● A smaller, faster RAM unit, called a cache, is used to hold sections of a program that
are currently being executed, along with any associated data.
● The cache is tightly coupled with the processor and is usually contained on the same
integrated-circuit chip.
● The purpose of the cache is to facilitate high instruction execution rates.
● The largest and slowest unit is referred to as the main memory.
● Secondary storage is an additional, less expensive, permanent storage used when large
amounts of data and many programs have to be stored, particularly for information that
is accessed infrequently.
● Examples: Magnetic disks and tapes and optical disks (DVD and CD).
Arithmetic and logic units
● Most computer operations are executed in the arithmetic and logic unit (ALU) of the
processor.
● For example, if two numbers located in the memory are to be added, they are brought
SAVITA M, DEPT OF E&CE 5
COMPUTER ORGANIZATION & ARCHITECTURE
into the processor, and the addition is carried out by the ALU. The sum may then be
stored in the memory or retained in the processor for immediate use.
● Any arithmetic or logic operation, addition, subtraction, multiplication, division, or
comparison of numbers can also be done by the ALU.
● When operands are brought into the processor, they are stored in high speed storage
elements called registers.
● Each register can store one word of data.
● Access time to register is faster than that of cache.
● The control and arithmetic and logic units are many times faster than other devices
connected to a computer system.
Output Unit
● The output unit is the counterpart of the input unit.
● Its function is to send processed results to the outside world.
● A familiar example of such a device is a printer. Most printers employ either
photocopying techniques, as in laser printers, or ink jet streams.
● It is possible to produce printers capable of printing as many as 10,000 lines per minute.
● Some units, such as graphic displays, provide both an output function, showing text and
graphics, and an input function, through touchscreen capability.
● The dual role of such units is the reason for using the single name input/output (I/O)
unit in many cases.
Control Unit
● The responsibility of the control unit is to coordinate the operations of memory,
arithmetic and logic, and I/O units that store and process information and perform input
and output operations.
● The control unit is effectively the nerve center that sends control signals to other units
and senses their states.
● Control circuits are responsible for generating the timing signals that govern the
transfers and determine when a given action is to take place.
● Data transfers between the processor and the memory are also managed by the control
SAVITA M, DEPT OF E&CE 6
COMPUTER ORGANIZATION & ARCHITECTURE
unit through timing signals.
● The operation of a computer can be summarized as follows:
▪ The computer accepts information in the form of programs and data through an
input unit and stores it in the memory.
▪ Information stored in the memory is fetched under program control into an
arithmetic and logic unit, where it is processed.
▪ Processed information leaves the computer through an output unit.
▪ All activities in the computer are directed by the control unit.
Basic Operational Concepts
● To perform a given task, an appropriate program consisting of a list of instructions is
stored in the memory.
● Individual instructions are brought from the memory into the processor, which executes
the specified operations.
● Data to be used as instruction operands are also stored in the memory. A typical
instruction might be
Add LOCA, R0
(Operation source, source/destination)
● This instruction adds the operand at memory location LOCA to the operand in a register
in the processor, R0, and places the sum into register R0.
● The original contents of location LOCA are preserved, whereas those of register R0 are
overwritten.
● Execution of this instruction requires several steps.
1. The instruction is fetched from the memory into the processor.
2. The operation to be performed is determined by the control unit.
3. The operand at LOCA is then fetched from the memory into the processor and
added to the contents of R0.
4. The resulting sum is then stored in register R0.
• In the above example, Add instruction combines a memory access operation with an
ALU operation.
• Let us consider one more example.
Load LOCA,R1
SAVITA M, DEPT OF E&CE 7
COMPUTER ORGANIZATION & ARCHITECTURE
Add R1,R0
● Execution of the above instructions requires several steps.
1. In the first instruction, the content of memory location LOCA is transferred (copied)
to the processor register R1.
2. In the second instruction, the contents of registers R1 and R0 are added.
3. The sum is placed in the register R0.
• Note: The original contents of R1 and R0 are destroyed in the process whereas the
original content of LOCA memory location is preserved.
Connection between the processor and the memory
• Instruction register (IR): holds the instruction that is currently being executed.
• Program Counter (PC): contains the memory address of the next instruction to be
fetched and executed.
• Memory Address Register (MAR): holds the address of the location to be accessed.
• Memory Data Register (MDR): contains data to be written into or read out of the
addressed location.
• General Purpose Registers (R0, R1, ….., Rn-1): They are also called processor
registers. They serve a variety of functions, including holding operands that have been
loaded from the memory for processing.
• The program resides in the memory and usually gets there through the input unit.
SAVITA M, DEPT OF E&CE 8
COMPUTER ORGANIZATION & ARCHITECTURE
• Consider some typical operating steps for the execution of a program:
1. PC is set to point to the first instruction of a program.
2. The contents of PC are transferred to the MAR and a read control signal is sent to the
memory.
3. The addressed word is read out of memory and loaded into the MDR.
4. The contents of MDR are now transferred to the IR. At this point, the instruction is
ready to be decoded and executed.
5. If the instruction involves an operation to be performed by the ALU and that operand
resides in the memory, it has to be fetched by sending its address to the MAR and
initiating a read cycle.
6. When the operand has been read from the memory into MDR, it is transferred from
the MDR to ALU.
7. If the result of this operation is to be stored in the memory, then the result is sent to
MDR.
8. The address of the location where the result is to be stored is sent to the MAR and a
write cycle is initiated.
9. At some point during the execution of the current instruction, the contents of the PC
are incremented so that PC points to the next instruction to be executed. Thus as soon
as the execution of the current instruction is completed, a new instruction fetch may
be started.
• For the purpose of handling I/O transfers some machine instructions are provided, for
computer to accept data from input devices and to send data to output devices.
• In case some device requires urgent service for example, a monitoring device in a
computer-controlled industrial process may detect a dangerous condition, to respond
immediately, execution of the current program must be interrupted.
• To do this the device raises an interrupt signal.
• An interrupt is a request from an I/O device for service by the processor.
• The processor provides the requested service by executing an appropriate interrupt service
routine.
• Internal state of the processor might get altered. Therefore its state must be saved in the
memory before servicing the interrupt request; the information that is saved includes the
contents of the PC, the contents of the general-purpose registers, and some control
information.
SAVITA M, DEPT OF E&CE 9
COMPUTER ORGANIZATION & ARCHITECTURE
• When the interrupt-service routine is completed, the state of the processor is restored from
the memory so that the interrupted program may continue.
Bus Structures:
• A group of lines that serves as connecting path for several devices is called bus.
• They must have lines for carrying data, address and control purposes.
• Bit is transferred over a line and group of lines help in simultaneous transfer of several bits.
• To interconnect functional units a single bus can be used and bus can be used for only one
transfer at a time and hence only two units can actively use the bus at any time.
• The main intension of using a single bus is its low cost and its flexibility for attaching
peripheral devices.
• Systems can use multiple buses for more concurrency that is two or more transfers at a time
that leads to better performance but at the increased cost.
• Devices connected to the bus vary in their speed of operations (Key boards, printers etc are
slow; magnetic/optical disks are fast.)
• Memory and processing units operate at electronic speeds.
• An efficient transfer mechanism has to be used for communication between all devices that
is not constrained by slow devices and that can be used to smooth out the differences in
timing among processors, memories and external devices.
• Buffer registers are included in the devices to hold the information during transfers.
• For example, consider the transfer of an encoded character from a processor to a character
SAVITA M, DEPT OF E&CE 10
COMPUTER ORGANIZATION & ARCHITECTURE
printer.
• Processor sends the character over the bus to the printer buffer register.
• Since the buffer is an electronic register, this transfer requires relatively little time.
• Once the buffer is loaded, the printer can start printing without further intervention by the
processor.
• The bus and the processor are no longer needed and can be released for other activity.
• The printer continues printing the character in its buffer and is not available for further
transfers until this process is completed.
• This allows the processor to switch rapidly from one device to another.
• Thus, buffer registers smooth out the timing differences among processors, memories,
and I/O devices.
• They prevent a high-speed processor from being locked to slow device during the sequence
of data transfers.
Software:
• In order for the user to enter and run an application program, the computer must contain
some system software in its memory.
• System software is responsible for the coordination of all the activities in computer system.
• System software is a collection of programs that are executed as needed to perform the
following functions-
• Receiving and interpreting user commands.
• Entering and editing application programs and storing them as files in secondary
memory storage devices.
• Managing the storage and retrieval of the files in secondary storage devices.
• Running standard application programs such as word processors, spread sheets, or
games, with data supplied by the user.
• Controlling I/O units to receive input information and produce output results.
• Translating programs from the source form prepared by the user in to oject form
consisting of machine instructions
• Linking and running user written application programs with existing standard
library routines, such as numerical computation packages
SAVITA M, DEPT OF E&CE 11
COMPUTER ORGANIZATION & ARCHITECTURE
Operating system (OS)
• Key system software component is Operating system (OS).
• OS is a large program, a collection of routines that is used to control the sharing of and
interaction among various computer units that is used to control the sharing of and
interaction among various computer units as they execute application program.
• The OS routines perform the tasks required to assign computer resources to individual
application programs.
• The tasks include assigning memory and magnetic disk space to program and data files,
moving data between memory and disk units and handling I/O operations.
Basics understanding of OS
To understand the basics of OS with one processor, one disk and one printer
Consider that an application program has been compiled from high level language form and
stored in the disk.
The first step is to transfer this file in to the memory. Then the execution of the program is
started.
• Assume that a part of program involves reading a data file from the disk in to the
memory and performing some computation on the data and printing the results.
• When the execution of the program reaches the point where data file is needed, the
program requests the OS to transfer the data file from the disk to memory.
• OS performs this operation and passes execution control back to the application
program, which proceeds to perform required computation.
• After the computation is completed the results are ready to be printed.
• The application program again sends the request to the OS.
• An OS routine is then executed to cause the printer to print the results.
Illustration of Program and OS routine sharing the processor time
SAVITA M, DEPT OF E&CE 12
COMPUTER ORGANIZATION & ARCHITECTURE
• A time line diagram helps in understanding the sharing the processor time.
• During the time period t0 to t1, OS routine initiates loading an application program
from the disk to memory, waits until the transfer is completed, and then passes the
execution control to the application program.
• A similar pattern of activity occurs during period t2 to t3 and period t4 to t5, when
operating system transfers the data file from disk and prints the result.
• At time t5, the OS may load and execute another application program.
• When several application programs are to be processed, computer resources should be
used more efficiently
• In the above example disk and printer are idle during most of the time period t4 to t5.
• OS can load the next program to be executed in to the memory from the disk while
printer is printing.
• Similarly during t0 to t1, the OS can arrange to print previous program’s results while
the current program is loaded from the disk.
Thus in case of several application programs are to be processed OS uses multiprogramming
or multitasking i.e., concurrent execution of several application programs to make the best
possible use of computer resources.
Performance:
Measure of the performance of computer is how quickly it can execute programs.
SAVITA M, DEPT OF E&CE 13
COMPUTER ORGANIZATION & ARCHITECTURE
• The speed with which a computer executes programs is affected by the design of its
hardware and its machine language instructions.
• Because programs are usually written in a high level language, performance is also affected
by the compiler that translates program into machine language.
• For best performance, it is necessary to design a compiler, the machine instruction set and
the hardware in a coordinated way.
• Elapsed Time: It is the total time required to execute the program. It is a measure of the
performance of the entire computer system.
• In figure 1.4, t5-t0 is the elapsed time.
• It is affected by the speed of the processor, the disk and the printer.
• Processor Time: The sum of the periods during which the processor is active.
• For example, in fig. 1.4, processor time = (t1 to t2)+(t3 to t4).
• Processor time depends on the hardware involved in the execution of individual machine
instructions.
• Figure 1.5 shows the hardware setup comprising of processor along with cache memory as
a part of the processor and the memory which are usually connected by the bus.
• At the start of execution, all the program instructions and the data required are stored in the
main memory.
• As execution proceeds, instructions are fetched one by one over the bus in to the processor,
and a copy is placed in the cache.
• When the execution of instruction calls for data located in the main memory, the data are
fetched and the copy is placed in the cache. Later, if the same instruction or data is needed
a second time, it is read directly from the cache.
• The processor and relatively small cache memory can be fabricated on a single integrated
SAVITA M, DEPT OF E&CE 14
COMPUTER ORGANIZATION & ARCHITECTURE
circuit chip.
• The internal speed of performing the basic steps of instruction processing is very high and
considerably faster than the speed at which the instructions and data are fetched from the
main memory.
• A program will be executed faster if the movement of the instructions and data between
main memory and the processor is minimized by using cache.
• In case of program loop where repeated execution of the same instructions over a short
period is needed the instructions are readily available in cache making them available
quickly.
Processor clock:
• Processor circuits are controlled by timing signal called clock. Clock defines regular time
intervals, called clock cycles.
• To execute a machine instruction, the processor divides the action to be performed into the
sequence of basic steps and such each step can be completed in one clock cycle.
• The length P of one clock cycle is an important parameter that affects processor
performance.
• Its inverse is clock rate, R=1/P, measured in cycles per second called hertz (Hz).
• Processors used in computers now a days are having clock rates that range from a few
hundred million to over a billion cycles per second (Hz). Million is denoted by Mega (M)
and billion by Giga (G).
• Hence 500 million cycles per second is usually abbreviated to 500 Megahertz (MHz) and
1250 million cycles per second is usually abbreviated to 1.25 Gigahertz (GHz).
SAVITA M, DEPT OF E&CE 15
COMPUTER ORGANIZATION & ARCHITECTURE
Basic Performance Equation:
• We find here the processor time component of the total elapsed time.
• Let T be the processor time required to execute a program prepared in some HLL.
• Compiler generates a machine language object program that corresponds to source
SAVITA M, DEPT OF E&CE 16
COMPUTER ORGANIZATION & ARCHITECTURE
program.
• Let N = The number of machine instruction executions and is not necessarily equal to the
number machine instructions in the object program.
• Depending on the input data used some instructions may be executed more than once (in
case of loops), and some may not be executed at all.
• Let S = Average number of basic steps needed to execute one machine instruction, where
each basic step is completed in one clock cycle.
• Let R = The clock rate in hertz.
• Then
Program execution time = T= (N x S)/R
called basic performance equation.
• T for application program is much more important to the user than the individual values of
parameters N, S or R.
• To achieve high performance, the computer designer must seek ways to reduce the value T
which implies N and S should be reduced and R must be increased.
• The value of N is reduced if source program is compiled into fewer machine instructions.
• The value of S is reduced if instructions have a smaller number of basic steps to perform
or if the execution of instructions is overlapped.
• Using higher frequency clock increases the value of R that is the time required to compete
a basic execution step is reduced.
• N, S and R are not independent parameters, changing one may affect another.
• The design of the processor will lead to improved performance only if the overall result is
to reduce the value of T.
SAVITA M, DEPT OF E&CE 17