Unit - I
Unit - I
A computer is a device that transforms data into meaningful information. It processes the
input according to the set of instructions provided to it by the user and gives the desired
output. Computers are of various types, and they can be categorized in two ways on the basis
of size and on the basis of data handling capabilities.
So, based on size, there are five types of computers:
1. Supercomputer
2. Mainframe computer
3. Minicomputer
4. Workstation
5. PC (Personal Computer)
And on the basis of data handling capabilities, there are three types of computers:
1. Analogue Computer
2. Digital Computer
3. Hybrid Computer
PC (Personal Computer):
It is also known as a microcomputer. It is basically a general-purpose computer and designed
for individual use. It consists of a microprocessor as a central processing unit(CPU),
memory, input unit, and output unit. This kind of computer is suitable for personal work
such as making an assignment, watching a movie, or at office for office work, etc. For
example, Laptops and desktop computers.
Characteristics of PC (Personal Computer):
• In this limited number of software can be used.
• It is smallest in size.
• It is designed for personal use.
• It is easy to use.
Workstation:
Workstation is designed for technical or scientific applications. It consists of a fast
microprocessor, with a large amount of RAM and high speed graphic adapter. It is a single-
user computer. It generally used to perform a specific task with great accuracy.
Characteristics of Workstation:
• It is expensive or high in cost.
• They are exclusively made for complex work purposes.
• It provides large storage capacity, with better graphics, and a more powerful
CPU when compared to a PC.
• It is also used to handle animation, data analysis, CAD, audio and video
creation, and editing.
Minicomputer:
Minicomputer is a medium size multiprocessing computer. In this type of computer, there
are two or more processors, and it supports 4 to 200 users at one time. Minicomputers are
used in places like institutes or departments for different work like billing, accounting,
inventory management etc. It is smaller than a mainframe computer but larger in comparison
to the microcomputer.
Characteristics of minicomputer:
• Its weight is low.
• Because of its low weight, it is easy to carry anywhere.
• less expensive than a mainframe computer.
• It is fast.
Mainframe computer:
Mainframe computers are designed in such a way that it can support hundreds or thousands
of users at the same time. It also supports multiple programs simultaneously. So, they can
execute different processes simultaneously. All these features make the mainframe computer
ideal for big organizations like banking, telecom sectors, etc., which process a high volume
of data in general.
Characteristics of mainframe computers:
• It is also an expensive or costly computer.
• It has high storage capacity and great performance.
• It can process a huge amount of data (like data involved in the banking sector)
very quickly.
• It runs smoothly for a long time and has a long life.
Supercomputer:
When we talk about speed, then the first name that comes to mind when thinking of
computers is supercomputers. They are the biggest and fastest computers (in terms of speed
of processing data). Supercomputers are designed such that they can process a huge amount
of data, like processing trillions of instructions or data just in a second. This is because of the
thousands of interconnected processors in supercomputers. It is basically used in scientific
and engineering applications such as weather forecasting, scientific simulations, and nuclear
energy research. It was first developed by Roger Cray in 1976.
Characteristics of supercomputers:
• Supercomputers are the computers which are the fastest and they are also very
expensive.
• It can calculate up to ten trillion individual calculations per second, this is also the
reason which makes it even faster.
• It is used in the stock market or big organizations for managing the online
currency world such as bitcoin etc.
• It is used in scientific research areas for analysing data obtained from exploring
the solar system, satellites, etc.
Analogue Computer:
It is particularly designed to process analogue data. Continuous data that changes
continuously and cannot have discrete values is called analogue data. So, an analogue
computer is used where we don’t need exact values or need approximate values such as speed,
temperature, pressure etc. It can directly accept the data from the measuring device without
first converting it into numbers and codes. It measures the continuous changes in physical
quantity. It gives output as a reading on a dial or scale. For example speedometer, mercury
thermometer, etc.
Digital Computer:
Digital computers are designed in such a way that it can easily perform calculations and
logical operations at high speed. It takes raw data as an input and processes it with programs
stored in its memory to produce the final output. It only understands the binary input 0 and
1, so the raw input data is converted to 0 and 1 by the computer and then it is processed by
the computer to produce the result or final output. All modern computers, like laptops,
desktops including smartphones are digital computers.
Hybrid Computer:
As the name suggests hybrid, which means made by combining two different things.
Similarly, the hybrid computer is a combination of both analog and digital computers. Hybrid
computers are fast like an analog computer and have memory, and accuracy like a digital
computer. So, it has the ability to process both continuous and discrete data. For working
when it accepts analog signals as input then it converts them into digital form before
processing the input data. So, it is widely used in specialized applications where both analog
and digital data is required to be processed. A processor which is used in petrol pumps that
converts the measurements of fuel flow into quantity and price is an example of a hybrid
computer.
BASIC STRUCTURE OF THE COMPUTER AND ITS FUNCTIONAL UNITS
Every functional system incorporates some functional parts that constitute a consumable
product. Similarly, there are some functional units of the computer that constitute in producing
logical outputs.
a) input unit,
b) a processing unit (Arithmetic and logic),
c) a memory to store final or intermediate results,
d) a controlling unit that coordinates functions of every unit, and finally
e) an output unit.
The functional units of a computer i.e. input unit, arithmetic and logic unit, memory, control
unit, output unit all are connected with the interconnection network that helps them in
exchanging the information as you can see in the fig 1.
Input Unit:
The input to the computer is either a data or instruction, that guides the arithmetic and logic
unit about what operations have to be performed and also controls the movement of data
between the computer and its I/O devices.
Now, the input i.e. data or instruction are accepted with the help of input units such as a
keyboard, mouse, touchpad, joystick, and trackball. The most familiar device that we use to
accept input is the ‘keyboard’ and ‘mouse’. All of these input devices are graphic input devices
and you can see their effect on the display unit.
Whenever you strike any key on the keyboard it gets converts to the binary code and is handed
over to the processor which would interpret the code and perform the appropriate action.
For audio and video input, microphones and cameras are used respectively. Now a day, the
internet can also be used to issue an input to a computer from other computers or databases.
Memory Unit:
A memory unit is required to store the programs that have the set of instructions that instructs
Arithmetic and logic unit which operation has to be performed. It also stores the data associated
with the program. The memory can further be classified into three types:
a) Primary Memory:
Primary memory is also known as the main memory or the random-access memory (RAM).
It is the fastest accessible memory of the computer. If a program has to be executed it first
needs to be placed in the primary memory. Then the instructions of the program are fetched
one at a time by the processor for execution.
The memory is organized in such a way that in one basic operation, one-word can be
retrieved from the memory or one word can be stored to the memory. A word length could
be 16, 32, or 64 bits.
The primary memory is expensive as well as faster. But primary memory is volatile in
nature it does not retain its content when the power gets off.
b) Secondary Memory:
Secondary memory is the hard disk of your system, it also includes flash drive, optical disks,
magnetic disk. The secondary memory is slower and less expensive as compared to
primary memory. It doesn’t lose its contents even if the supply of power gets off.
We require secondary memory to store a large volume of data or program permanently or
the data that is less likely to be retrieved.
c) Cache Memory:
Cache memory can be accessed much faster as compared to primary memory and it is even
smaller in size. It is stored with the data that is required frequently by the processor.
As we know the program to be executed and the data associated with it is brought to the
primary memory and the processor fetches the program instructions from there. The process
also places a copy of the instructions and associated data in the cache memory.
Now, the instructions that are required to be executed repeatedly such as loops are retrieved
from the cache memory to improve the execution rate.
All the arithmetic operations are performed by the arithmetic logic unit of the processors.
Arithmetic operations such as addition, subtraction, division, multiplication, comparison
between the numbers, etc.
The ALU unit performs the operations present in the instruction and stores the result into the
memory. It also stores the intermediate results of the operation in the registers.
The arithmetic operation is performed on the operands. The operands are placed into the
registers which store one word at a time which is sufficient for an operand. Retrieval of the
data form registers is even faster than the cache memory.
Output Unit:
A computer is a functional unit and as it has an input unit to accept the input it also has the
output unit to provide the generated output by the system. The most familiar device used to
output a result is a printer.
A display screen is also an output unit as it displays the generated result, but it also displays
the input provided to the system. That’s why the display screen is termed as the ‘I/O unit’
because of its dual function.
Control Unit:
The functions of input, ALU, memory, and output unit must be coordinated so that everything
goes in sequence i.e., the processor accepts input, place it in memory, processes the stored
input, and generates output. This entire sequence is coordinate by the control unit.
BASIC OPERATIONAL CONCEPTS OF COMPUTER
This instruction adds the operand at memory location LOCA, to operand in register R0 & places
the sum into register. This instruction requires the performance of several steps,
1. First the instruction is fetched from the memory into the processor.
2. The operand at LOCA is fetched and added to the contents of R0
3. Finally the resulting sum is stored in the register R0
The preceding add instruction combines a memory access operation with an ALU Operations.
In some other type of computers, these two types of operations are performed by separate
instructions for performance reasons.
Load LOCA, R1
Add R1, R0
Transfers between the memory and the processor are started by sending the address of the
memory location to be accessed to the memory unit and issuing the appropriate control signals.
The data are then transferred to or from the memory.
The instruction register (IR): Holds the instructions that is currently being executed. Its
output is available for the control circuits which generates the timing signals that control the
various processing elements in one execution of instruction.
The other two registers which facilitate communication with memory are:
1. MAR – (Memory Address Register): It holds the address of the location to be accessed.
2. MDR – (Memory Data Register): It contains the data to be written into or read out of the
address location.
Bus structures in computer plays important role in connecting the internal components of the
computer. The bus in the computer is the shared transmission medium. This means multiple
components or devices use the same bus structure to transmit the information signals to each
other.
At a time only one pair of devices can use this bus to communicate with each other successfully.
If multiple devices transmit the information signal over the bus at the same time the signals
overlap each other and get jumbled.
A system bus has typically from fifty to hundreds of distinct lines where each line is meant for
a certain function. These lines can be categories into three functional groups i.e., data lines,
address lines, and control lines. Let us discuss them one by one each.
Data Lines
Data lines coordinate in transferring the data among the system components. The data lines are
collectively called data bus. A data bus may have 32 lines, 64 lines, 128 lines, or even more
lines. The number of lines present in the data bus defines the width of the data bus.
Each data line is able to transfer only one bit at a time. So the number of data lines in a data
bus determines how many bits it can transfer at a time. The performance of the system also
depends on the width of the data bus.
Address Lines
The content of the address lines of the bus determines the source or destination of the data
present on the data bus. The number of address lines together is referred to as address bus. The
number of address lines in the address bus determines its width.
The width of the address bus determines the memory capacity of the system. The content of
address lines is also used for addressing I/O ports. The higher-order bits determine the bus
module and the lower ordered bits determine the address of memory locations or I/O ports.
Whenever the processor has to read a word from the memory it simply places the address of
the corresponding word on the address line.
Control Lines
The address lines and data lines are shared by all the components of the system so there must
some means to control the use and access of data and address lines. The control signals placed
on the control lines control the use and access to address and data lines of the bus. The control
signal consists of the command and timing information. Here the command in the control
signal specify the operation that has to be performed. And the timing information over the
control signals specify till when the data and address information is valid .
✓ Memory Write: This command causes the data on the data bus to be placed over
the addressed memory location.
✓ Memory Read: This command causes the data on the addressed memory location
to be placed on the data bus.
✓ I/O Write: The command over this control line causes the data on the data bus to
be placed over the addressed I/O port.
✓ I/O Read: The command over this control line causes the data from the addressed
I/O port to be placed over the data bus.
✓ Transfer ACK: This control line indicates the data has been received from the data
bus or is placed over the data bus.
✓ Bus Request: This control line indicates that the component has requested control
over the bus.
✓ Bus Grant: This control line indicates that the bus has been granted to the
requesting component.
✓ Interrupt Request: This control line indicates that interrupts are pending.
✓ Interrupt ACK: This control line provides acknowledgment when the pending
interrupt is serviced.
✓ Clock: This control line is used to synchronize the operations.
✓ Reset: The bit information issued over this control line initializes all the modules.
If a component connected to the bus wishes to send data to another connected component, it
first has to acquire control over the bus, and then it can transfer the data to another component
over the bus. The same happen when a component request data from another component.
During the transfer of data between two components, one component act as a master and other
act as a slave. The device initiating the data transfer is referred to as master and usually, it is a
processor, or sometimes it may be some other device or component. The component addressed
by the master component is referred to as a slave.
Timing in Bus
As we have seen that the control lines of the bus also provide timing information along with
the command. Well, the way of deriving the timing information over the control line can be
categorized in two ways:
Synchronous Bus
With the synchronous bus scheme, all the devices or components connected to the bus derive
timing information over the control line referred to as the bus clock. Over the bus clock line,
the clock transmits an alternating sequence of 1s and 0s at a regular interval. Here a single 1-0
transmission is considered as a clock cycle or bus cycle.
All the devices or components connected to the bus can read this bus clock line and all the
events start at the starting the clock cycle. Here the transmitting component and the receiving
component are synchronized using the clock. The data is sent or received at a constant rate and
therefore used for high-speed transmission.
Asynchronous Bus
In this asynchronous bus scheme, the transmitter and the receiver component are not
synchronized by the clock. Instead, the data transfer is controlled using a handshake protocol
between the master component and the slave component.
Here, the component initiating the data transfer i.e. master component when gets ready for data
transfer indicates this by activating its master-ready line and places the address and command
information over the bus.
Then all the connected component decodes the address on the address line to recognize which
component is being addressed by the master component.
Now the addressed component performs the required operation and notifies the processor by
activation its slave ready-line. Once the master recognizes the activated slave ready-line it
removes its control over the bus.
In this way occurrence of one event on the bus is followed by and depends on the occurrence
of a previous event.
I/O Interface of Input Device Connected to Bus
In the section ahead we will discuss how these three things over the bus are decoded by the I/O
interface.
Figure 4: Bus Structure for I/O Interface of an Input Device
Each I/O device interface has a set of registers with unique addresses. Whenever the processor
puts an address over the address line of the bus, it is examined by all the devices connected to
the bus. Whichever device recognizes this address responds to the control operations issued on
the control lines of the bus.
The processor issues read/write operation over the control lines of the bus and the data
corresponding to the read and write operation is transmitted over the data lines of the bus.
Consider that we have an input device keyboard and some data from the keyboard has to be
issued to the processor, the machine instruction for the same is:
LOAD R2, DATAIN
Here the DATAIN is the data register of the Keyboard. This instruction reads the content from
DATAIN register of the keyboard and transfers the content to the R2 register of the processor.
Similarly, the instruction below:
STORE R2, DATAOUT
Here consider that the DATAOUT register is the data register of a display device. So, this
instruction will transfer the content of register R2 of the processor to the data register of the
display device.
The control register and the status register of the I/O device interface have information relevant
to the operation performed on or by the I/O device. The address decoder, control circuitry and
the registers of the I/O interface coordinate in transferring the content to or from the I/O device.
Software
For the user to enter and run an application program, the computer must already contain some
system software in its memory.
System Software is a collection of programs that are executed as needed to perform functions
such as:
a) Receiving and interpreting user commands
b) Entering and editing application programs and storing them as files in secondary
storage devices
c) Managing the storage and retrieval of files in secondary storage devices
d) Running standard application programs such as word processors, spreadsheets, or
games, with data supplied by the user
e) Controlling I/O units to receive input information and produce output results
f) Translating programs form source form prepared by the user into object form consisting
of machine instructions
g) Linking and running user-written application program with existing standard library
routines, such as numerical computation packages.
Hence, the System Software is thus responsible for the coordination of all activities in a
computer system.
Some of the basic aspects of the system software are:
Application Programs: They are usually written in a high-level programming language, such
as C, C++, Java etc., in which the programmer specifies mathematical or text-processing
operations. These operations are described in a format that is independent of the particular
computer used to execute the program.
A programmer using a high-level language need not know the details of machine program
instructions. A system software program called compiler translates the high-level language
program into suitable machine language program containing instructions such as Add or load
instructions.
Text-Editor: It is another important system program that all programmers use. It is used for
entering and editing application programs. The user of this program interactively executes
command that allow statements of a source program entered at a keyboard to be accumulated
in a file.
A File is simply a sequence of alphanumeric characters or binary data that is stored in memory
or in secondary storage. A file can be referred to by a name chosen by the user.
Assume that part of the program’s task involves reading a data file from the disk into the
memory, performing some computations on the data, printing the results. When the execution
of the program reaches the point where the data file is needed, the program requests the
operating system to transfer the data file from the disk to the memory.
The OS performs this task and passes execution control back to the application program, which
then proceeds to perform the required computation. When the computation is completed and
the results are ready to be printed, the application program again sends a request to the
operating system. An OS routine is then executed to cause the printer to print the results.
This is the process of execution control passes back and forth between the application program
and the OS routines. The sharing of the processor execution time is by a time-line diagram
illustrated in the below figure 5 .
During time period t0 and t1, an OS routine initiates loading the application program form the
disk to memory, waits until the transfer is completed, and then passes execution control to the
application program. A similar pattern of activity occurs during the period t2 and t3 and period
t4 and t5. When the operating system transfers the data file from the disk and prints the results.
At t5, the operating system may load and execute another application program.
If we notice carefully, the disk and the processor are idle during most of the time period t 4 to
t5. The operating system can load the next program to be executed into the memory from the
disk while the printer is operating.
Similarly, during the t0 to t1. The operating system can arrange to print the previous program’s
results while the current program is being loaded from the disk. Thus, the operating system
manages the concurrent execution of several application programs to make the best possible
use of computer resources. This process of concurrent execution is called multiprogramming
or multitasking.
Performance
Performance is the measure of a computer that how quickly it can execute programs. The
speed with which a computer executes programs is affected by the design of its hardware and
its machine language instructions.
As programs are usually written in a high-level language, performance is also affected by the
compiler that translates programs into machine language.
For best performance, it is necessary to design the compiler, the machine instruction set, and
the hardware in a coordinated way.
From the earlier discussion and from the figure 3 the total time required to execute the program
is t0 to t5. This elapsed time is the measure of the performance of the entire computer system.
It is affected by the speed of the processor, the disk and the printer.
To discuss the performance of the processor, we should consider only the periods during which
the processor is active. These are the periods as the processor time needed to execute the
program. These are the periods labeled Program and OS routines in figure 5. The sum of these
periods as the processor time needed to execute the program.
Just as elapsed time for the execution of a program depends on all units in a computer system,
the processor time depends on the hardware involved in the execution of individual machine
instructions. This hardware comprises the processor and the memory, which are usually
connected by a bus as shown in fig 3.
The pertinent parts of this figure are repeated in figure 6, including the cache memory as part
of the processor unit.
At the start of the execution, all program instructions and the required data are stored in the
main memory. As execution proceeds, instructions are fetched one by one over the bus into the
processor, and a copy is placed in the cache. When the execution of an instruction calls for data
located in the main memory, the data are fetched and a copy is placed in the cache. Later, if the
same instruction is needed a second time, it is read directly from the cache.
The processor and a relatively small cache memory can be fabricated on a single integrated
circuit chip. The internal speed of performing the basic steps of instruction processing on such
chips is very high and is considerably faster than the speed at which instructions and data can
be fetched from the main memory.
A program will be executed faster if the movement of instructions and data between the main
memory and the processor is minimized, which is achieved by using the cache. For example,
suppose a number of instructions are executed repeatedly over a short period of time, as
happens in a program loop. If these instructions are available in the cache, they can be fetched
quickly during the period of repeated use. The same applies to data that are used repeatedly.
Processor Clock:
Processor circuits are controlled by a timing signal called a CLOCK. The clock defines regular
time intervals, called clock cycles. To execute a machine instruction, the processor divides the
action to be performed into a sequence of basic steps, such that 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 the clock rate,
𝑅 = 1⁄𝑃
Which is measured in cycles per second. Processors used in today’s personal computers and
workstations have clock rates that range from a few hundred million to over a billion cycles
per second.
Pipelining allows the processor to read a new instruction from memory before it is finished
processing the current one. It works by splitting the instruction fetch, decode and execution
into independent stages; as an instruction goes through each stage, the next instruction follows
it does not need to wait until it completely finishes. The extent to which pipelined data can flow
into the processor is called the pipeline depth.
Clock Rate:
There are two possibilities for increasing the clock rate, R.
1) Improving the integrated-circuit (IC) technology makes logic circuits faster, which
reduces the time needed to complete a basic step. This allows the clock period, P, to be
reduced and the clock rate, R, to be increased.
2) Reducing the amount of processing done in one basic step also makes it possible to
reduce the clock period, P. However, if the actions that have to be performed by
instructions remain the same the number of basic steps needed may increase.
Increases in the value of R that are entirely caused by improvements in IC technology affect
all aspects of the processor’s operation equally with the exception of the time it takes to access
the main memory.
In the presence of a cache, the percentage of accesses to the main memory is small. Hence,
much of the performance gain expected from the use of faster technology can be realized. The
value of T will be reduced by the same factor as R is increased because S and N are not affected.
The impact on performance of changing the way in which instructions are divided into basic
steps is more difficult to assess.