Computer Fundamentals and Generations
Computer Fundamentals and Generations
Overview
T world is an information-rich world and it has become a necessity for everyone to know about
computers. Purpose of this tutorial is to introduce you about computer and its fundamentals.
Functionalities of a computer
Any digital computer carries out five functions in gross terms:
Stores the data/instructions in its memory and use them when required.
Definition
Computer is an electronic data processing device which
8
generates the output in a required format.
Advantages
Following list demonstrates the advantages of computers in today's arena.
High Speed
Computer is a very fast device.
The computer has units of speed in microsecond, nanosecond, and even the picosecond.
It can perform millions of calculations in a few seconds as compared to man who will spend many months for
doing the same task.
Accuracy
In addition to being very fast, computers are very accurate.
Computers perform all jobs with 100% accuracy provided that correct input has been given.
Storage Capability
Memory is a very important characteristic of computers.
It can store any type of data such as images, videos, text, audio and many others.
Diligence
Unlike human beings, a computer is free from monotony, tiredness and lack of concentration.
Versatility
A computer is a very versatile machine.
9
This machine can be used to solve the problems related to various fields.
At one instance, it may be solving a complex scientific problem and the very next moment it may be playing a
card game.
Reliability
A computer is a reliable machine.
Automation
Computer is an automatic machine.
Once a program is given to computer i.e. stored in computer memory, the program and instruction can
control the program execution without human interaction.
As data in electronic files can be retrieved as and when required, the problem of maintenance of large
number of paper files gets reduced.
Reduction in Cost
Though the initial investment for installing a computer is high but it substantially reduces the cost of each of
its transaction.
Disadvantages
Following list demonstrates the disadvantages of computers in today's arena.
No I.Q
A computer is a machine that has no intelligence to perform any task.
10
Dependency
It functions as per a user instruction, so it is fully dependent on human being.
Environment
The operating environment of computer should be dust free and suitable.
No Feeling
Computers have no feelings or emotions.
It cannot make judgment based on feeling, taste, experience, and knowledge unlike a human being.
11
CHAPTER
Generations
Computer Generations
G eneration in computer terminology is a change in technology a computer is/was being used. Initially, the
generation term was used to distinguish between varying hardware technologies. But nowadays, generation
includes both hardware and software, which together make up an entire computer system.
There are totally five computer generations known till date. Each generation has been discussed in detail along
with their time period and characteristics. Here approximate dates against each generations have been mentioned
which are normally accepted.
First Generation
1
The period of first generation: 1946-1959. Vacuum tube based.
Second Generation
2
The period of second generation: 1959-1965. Transistor based.
Third Generation
3
The period of third generation: 1965-1971. Integrated Circuit based.
Fourth Generation
4
The period of fourth generation: 1971-1980. VLSI microprocessor based.
Fifth Generation
5
The period of fifth generation: [Link] microprocessor based
First Generation
The period of first generation was 1946-1959. The computers of first generation used vacuum tubes as the basic
components for memory and circuitry for CPU (Central Processing Unit). These tubes, like electric bulbs, produced
a lot of heat and were prone to frequent fusing of the installations, therefore, were very expensive and could be
afforded only by very large organisations. In this generation mainly batch processing operating system were used.
Punched cards, paper tape, and magnetic tape were used as input and output devices. The computers in this
generation used machine code as programming language.
21
The main features of first generation are:
Unreliable
Very costly
Huge size
Need of A.C.
Non-portable
ENIAC
EDVAC
22
UNIVAC
IBM-701
IBM-650
Second Generation
The period of second generation was 1959-1965. In this generation transistors were used that were cheaper,
consumed less power, more compact in size, more reliable and faster than the first generation machines made of
vacuum tubes. In this generation, magnetic cores were used as primary memory and magnetic tape and magnetic
disks as secondary storage devices. In this generation assembly language and high-level programming languages
like FORTRAN, COBOL were used. The computers used batch processing and multiprogramming operating
system.
Use of transistors
23
A.C. needed
IBM 1620
IBM 7094
CDC 1604
CDC 3600
UNIVAC 1108
Third Generation
The period of third generation was 1965-1971. The computers of third generation used integrated circuits (IC's) in
place of transistors. A single IC has many transistors, resistors and capacitors along with the associated circuitry.
The IC was invented by Jack Kilby. This development made computers smaller in size, reliable and efficient. In this
generation remote processing, time-sharing, multi-programming operating system were used. High-level languages
(FORTRAN-II TO IV, COBOL, PASCAL PL/1, BASIC, ALGOL-68 etc.) were used during this generation.
IC used
Smaller size
24
Faster
Lesser maintenance
Still costly
A.C needed
IBM-360 series
Honeywell-6000 series
IBM-370/168
TDC-316
Fourth Generation
The period of fourth generation was 1971-1980. The computers of fourth generation used Very Large Scale
Integrated (VLSI) circuits. VLSI circuits having about 5000 transistors and other circuit elements and their
associated circuits on a single chip made it possible to have microcomputers of fourth generation. Fourth
generation computers became more powerful, compact, reliable, and affordable. As a result, it gave rise to
personal computer (PC) revolution. In this generation time sharing, real time, networks, distributed operating
system were used. All the high-level languages like C, C++, DBASE etc. were used in this generation.
25
The main features of fourth generation are:
Very cheap
Use of PC's
Pipeline processing
No A.C. needed
DEC 10
STAR 1000
26
PDP 11
CRAY-1(Super Computer)
CRAY-X-MP(Super Computer)
Fifth Generation
The period of fifth generation is 1980-till date. In the fifth generation, the VLSI technology became ULSI (Ultra
Large Scale Integration) technology, resulting in the production of microprocessor chips having ten million
electronic components. This generation is based on parallel processing hardware and AI (Artificial Intelligence)
software. AI is an emerging branch in computer science, which interprets means and method of making computers
think like human beings. All the high-level languages like C and C++, Java, .Net etc. are used in this generation.
AI includes:
Robotics
Neural networks
Game Playing
ULSI technology
27
Development of true artificial intelligence
Desktop
Laptop
NoteBook
UltraBook
ChromeBook
28
CHAPTER
Types
PC (Personal Computer)
A PC can be defined as a small, relatively inexpensive computer designed for an individual user. PCs are based
on the microprocessor technology that enables manufacturers to put an entire CPU on one chip. Businesses use
personal computers for word processing, accounting, desktop publishing, and for running spreadsheet and
database management applications. At home, the most popular use for personal computers is playing games and
surfing Internet.
Although personal computers are designed as single-user systems, these systems are normally linked together to
form a network. In terms of power, now-a-days High-end models of the Macintosh and PC offer the same
computing power and graphics capability as low-end workstations by Sun Microsystems, Hewlett-Packard, and
Dell.
29
Workstation
Workstation is a computer used for engineering applications (CAD/CAM), desktop publishing, software
development, and other such types of applications which require a moderate amount of computing power and
relatively high quality graphics capabilities.
Workstations generally come with a large, high-resolution graphics screen, large amount of RAM, inbuilt network
support, and a graphical user interface. Most workstations also have a mass storage device such as a disk drive,
but a special type of workstation, called a diskless workstation, comes without a disk drive.
Common operating systems for workstations are UNIX and Windows NT. Like PC, Workstations are also single-
user computers like PC but are typically linked together to form a local-area network, although they can also be
used as stand-alone systems.
Minicomputer
It is a midsize multi-processing system capable of supporting up to 250 users simultaneously.
30
Mainframe
Mainframe is very large in size and is an expensive computer capable of supporting hundreds or even thousands
of users simultaneously. Mainframe executes many programs concurrently and supports many simultaneous
execution of programs.
Supercomputer
Supercomputers are one of the fastest computers currently available. Supercomputers are very expensive and are
employed for specialized applications that require immense amount of mathematical calculations (number
crunching). For example, weather forecasting, scientific simulations, (animated) graphics, fluid dynamic
calculations, nuclear energy research, electronic design, and analysis of geological data (e.g. in petrochemical
prospecting).
31
32
CHAPTER
Components
A ll types of computers follow a same basic logical structure and perform the following five basic
operations for converting raw input data into information useful to their users
1 Take Input The process of entering data and instructions into the computer system.
Saving data and instructions so that they are available for processing as and
2 Store Data
when required.
The process of producing useful information or results for the user, such as a
4 Output Information
printed report or visual display.
Directs the manner and sequence in which all of the above operations are
5 Control the workflow
performed.
33
Input Unit
This unit contains devices with the help of which we enter data into computer. This unit makes link between user
and computer. The input devices translate the information into the form understandable by computer.
Memory Unit
Control Unit
Output Unit
Output unit consists of devices with the help of which we get the information from computer. This unit is a link
between computer and users. Output devices translate the computer's output into the form understandable by
users.
34
CHAPTER
Control Unit
35
Memory or Storage Unit:
This unit can store instructions, data and intermediate results. This unit supplies information to the other units of
the computer when needed. It is also known as internal storage unit or main memory or primary storage or
Random access memory(RAM).
Its size affects speed, power and capability. Primary memory and secondary memory are two types of memories
in the computer. Functions of memory unit are:
It stores all the data and the instructions required for processing.
It stores final results of processing before these results are released to an output device.
Control Unit
This unit controls the operations of all parts of computer but does not carry out any actual data processing
operations.
It is responsible for controlling the transfer of data and instructions among other units of a computer.
It obtains the instructions from the memory, interprets them, and directs the operation of the computer.
It communicates with Input/Output devices for transfer of data or results from storage.
36
ALU(Arithmetic Logic Unit)
This unit consists of two subsections namely
Arithmetic section
Logic Section
Arithmetic Section
Function of arithmetic section is to perform arithmetic operations like addition, subtraction, multiplication and
division. All complex operations are done by making repetitive use of above operations.
Logic Section
Function of logic section is to perform logic operations such as comparing, selecting, matching and merging of
data.
37
CHAPTER
Input Devices
F ollowing are few of the important input devices which are used in a computer:
Keyboard
Mouse
Joy Stick
Light pen
Track Ball
Scanner
Graphic Tablet
Microphone
Keyboard
Keyboard is the most common and very popular input device which helps in inputting data to the computer. The
layout of the keyboard is like that of traditional typewriter, although there are some additional keys provided for
performing additional functions.
Keyboards are of two sizes 84 keys or 101/102 keys, but now keyboards with 104 keys or 108 keys are also
available for Windows and Internet.
38
CHAPTER
Output Devices
F ollowing are few of the important output devices which are used in a computer
Monitors
Graphic Plotter
Printer
Monitors
Monitors, commonly called as Visual Display Unit (VDU), are the main output device of a computer. It forms
images from tiny dots, called pixels that are arranged in a rectangular form. The sharpness of the image depends
upon the number of pixels.
A finite number of characters can be displayed on a screen at once. The screen can be divided into a series of
character boxes - fixed location on the screen where a standard character can be placed. Most screens are
capable of displaying 80 characters of data horizontally and 25 lines vertically. There are some disadvantages of
CRT
Large in Size
46
CHAPTER
Memory
A memory is just like a human brain. It is used to store data and instructions. Computer memory is the
storage space in computer where data is to be processed and instructions required for processing are stored. The
memory is divided into large number of small parts called cells. Each location or cell has a unique address which
varies from zero to memory size minus one. For example if computer has 64k words, then this memory unit has 64
* 1024=65536 memory locations. The address of these locations varies from 0 to 65535.
Cache Memory
Secondary Memory
Cache Memory
Cache memory is a very high speed semiconductor memory which can speed up CPU. It acts as a buffer between
the CPU and main memory. It is used to hold those parts of data and program which are most frequently used by
CPU. The parts of data and programs are transferred from disk to cache memory by operating system, from where
CPU can access them.
Advantages
The advantages of cache memory are as follows
It stores the program that can be executed within a short period of time.
Disadvantages
The disadvantages of cache memory are as follows
55
Cache memory has limited capacity.
It is very expensive.
56
Secondary Memory
This type of memory is also known as external memory or non-volatile. It is slower than main memory. These are
used for storing data/Information permanently. CPU directly does not access these memories instead they are
accessed via input-output routines. Contents of secondary memories are first transferred to main memory, and
then CPU can access it. For example: disk, CD-ROM, DVD etc.
It is non-volatile memory.
57
58
CHAPTER
R AM(Random Access Memory) is the internal memory of the CPU for storing data, program and program
result. It is read/write memory which stores data until the machine is working. As soon as the machine is switched
off, data is erased.
Access time in RAM is independent of the address that is, each storage location inside the memory is as easy to
reach as other locations and takes the same amount of time. Data in the RAM can be accessed randomly but it is
very expensive.
RAM is volatile, i.e. data stored in it is lost when we switch off the computer or if there is a power failure. Hence a
backup uninterruptible power system(UPS) is often used with computers. RAM is small, both in terms of its
physical size and in the amount of data it can hold.
59
Static RAM (SRAM)
The word static indicates that the memory retains its contents as long as power is being supplied. However, data
is lost when the power gets down due to volatile nature. SRAM chips use a matrix of 6-transistors and no
capacitors. Transistors do not require power to prevent leakage, so SRAM need not have to be refreshed on a
regular basis.
Because of the extra space in the matrix, SRAM uses more chips than DRAM for the same amount of storage
space, thus making the manufacturing costs higher. So SRAM is used as cache memory and has very fast access.
Faster
Large size
Expensive
Used as RAM
Lesser in size
Less expensive
60
CHAPTER
R OM stands for Read Only Memory. The memory from which we can only read but cannot write on it. This
type of memory is non-volatile. The information is stored permanently in such memories during manufacture. A
ROM, stores such instructions that are required to start a computer. This operation is referred to as bootstrap.
ROM chips are not only used in the computer but also in other electronic items like washing machine and
microwave oven.
61
PROM (Programmable Read only Memory)
PROM is read-only memory that can be modified only once by a user. The user buys a blank PROM and enters
the desired contents using a PROM program. Inside the PROM chip there are small fuses which are burnt open
during programming. It can be programmed only once and is not erasable.
EEPROM
(Electrically Erasable and Programmable Read Only
Memory)
The EEPROM is programmed and erased electrically. It can be erased and reprogrammed about ten thousand
times. Both erasing and programming take about 4 to 10 ms (milli second). In EEPROM, any location can be
selectively erased and programmed. EEPROMs can be erased one byte at a time, rather than erasing the entire
chip. Hence, the process of re-programming is flexible but slow.
Advantages of ROM
The advantages of ROM are as follows:
Non-volatile in nature
Easy to test
62
CHAPTER
Memory Units
Bit (Binary A binary digit is logical 0 and 1 representing a passive or an active state of a
1
Digit) component in an electric circuit.
A group of 8 bits is called byte. A byte is the smallest unit which can represent a
3 Byte
data item or a character.
A computer word, like a byte, is a group of fixed number of bits processed as a unit
which varies from computer to computer but is fixed for each computer.
4 Word The length of a computer word is called word-size or word length and it may be as
small as 8 bits or may be as long as 96 bits. A computer stores the information in
the form of computer words.
65
Few higher storage units are following
66
CHAPTER
Operating System
An operating system is a program that acts as an interface between the software and the computer
hardware.
It is an integrated set of specialised programs that are used to manage overall resources and operations of
the computer.
It is specialised software that controls and monitors the execution of all other programs that reside in the
computer, including application programs and other system software.
To act as an intermediary between the hardware and its users and making it easier for the users to access
and use other resources
To keep track of who is using which resource, granting resource requests, according for resource using and
mediating conflicting requests from different programs and users
To provide efficient and fair sharing of resources among users and programs
92
Characteristics of Operating System
Memory Management -- keeps tracks of primary memory i.e. what part of it is in use by whom, what part is
not in use etc. and allocates the memory when a process or program requests it.
Processor Management -- allocates the processor(CPU) to a process and deallocates processor when it is
no longer required.
Device Management -- keeps track of all devices. This is also called I/O controller that decides which
process gets the device, when, and for how much time.
File Management -- allocates and de-allocates the resources and decides who gets the resources.
Security -- prevents unauthorized access to programs and data by means of passwords and similar other
techniques.
Job accounting -- keeps track of time and resources used by various jobs and/or users.
Control over system performance -- records delays between request for a service and from the system.
Interaction with the operators -- The interaction may take place via the console of the computer in the
form of instructions. Operating System acknowledges the same, does the corresponding action and informs
the operation by a display screen.
Error-detecting aids -- Production of dumps, traces, error messages and other debugging and error-
detecting methods.
Coordination between other software and users -- Coordination and assignment of compilers,
interpreters, assemblers and other software to the various users of the computer systems.
93
Generations and Classification of programming languages:
There are five generations of Programming languages. They are:
First Generation Languages:
These are low-level languages like machine language (0/1).
Second Generation Languages:
These are low-level assembly languages used in kernels and hardware drives.
Third Generation Languages:
These are high-level languages like C, C++, Java, Visual Basic, and JavaScript.
Fourth Generation Languages:
These are languages that consist of statements that are similar to statements in the human
language. These are used mainly in database programming and scripting. Examples of these
languages include Perl, Python, Ruby, SQL, MATLAB (Matrix Laboratory).
Fifth Generation Languages:
These are the programming languages that have visual tools to develop a program. Examples
of fifth-generation languages include Mercury, OPS5, and Prolog.
The first two generations are called low-level languages. The next three generations are
called high-level languages.
Advantages of flowchart:
• Easy and efficient to analyse problem, plays the role of a blueprint for a program.
#include <stdio.h>
int main()
{
int p, n;
float r, si;
printf (“Enter values of p, n, r \n”); /* can be taken separately */
scanf (“%d %d %f ”, &p, &n, &r); /* can be taken separately */
si = p * n * r / 100;
printf (“%f\n”, si);
return 0;
}
The first printf() outputs the message ‘Enter values of p, n, r’ on the screen.
Note the use of ampersand ( & ) before the variables in the scanf() function is necessary. & is
the ‘Address of ’ operator. It gives the location number (address) used by the variable in
memory. When we say &a , we are telling scanf() at which memory location should it store
the value supplied by the user from the keyboard.
C Instructions:
There are three types of instructions in C:
(a) Type Declaration Instruction - This instruction is used to declare the type of variables
used in a C program.
(b) Arithmetic Instruction - This instruction is used to perform arithmetic operations on
constants and variables.
(c) Control Instruction - This instruction is used to control the sequence of execution of
various statements in a C program.
A variable must be defined before using it. The following statement is illegal since we are using
variable a before defining it.
float b = a + 3.1, a = 1.5;
The following statements would work
int a, b, c, d;
a = b = c = 10;
However, the following statement would not work
int a = b = c = d = 10;
Once again, we are trying to use b (to assign to a) before defining it.
C allows only one variable on left-hand side of = . That is, z = k * l is legal, whereas k * l = z
is illegal.
In addition to the division operator, C also provides a modular division operator. This operator
returns the remainder on dividing one integer with another. Thus, the expression 10 / 2 yields
5, whereas, 10 % 2 yields 0.
Note that the modulus operator ( % ) cannot be applied on a float. Also note that on using %,
sign of the remainder is always same as the sign of the numerator. Thus -5 % 2 yields -1,
whereas, 5 % -2 yields 1.
There is no operator in C to perform exponentiation operation. Exponentiation has to be carried
out as shown below:
float a;
a = pow (3.0, 2.0);
printf (“%f”, a);
Here pow() function is a standard library function. It is being used to raise 3.0 to the power of
2.0. The pow() function works only with real numbers, hence we have used 3.0 and 2.0.
Note that for pow() to work, it is necessary to #include <math.h> .
Hierarchy of Operations:
The priority or precedence in which the operations are performed is called the hierarchy of
operations. Parentheses has the highest priority followed by
Sum of n natural numbers:
#include<stdio.h>
int main()
{
int n = 9; // declare & initialize local variable n.
int sum = (n * (n + 1) ) / 2; /* define the mathematical formula to calculate the sum of given
number. */
printf("Sum of %d natural number is = %d", n, sum); // print the sum of natural number
return 0;
}
Loop Control:
The versatility of computer lies in its ability to perform a set of instructions repeatedly. This
involves repeating some portion of the program either a specified number of times or until a
particular condition is satisfied. This repetitive operation is done through a loop control
instruction. There are three ways to repeat a part of a program. They are:
(a) Using a while statement
(b) Using a for statement
(c) Using a do-while statement
The while loop:
do
{
this;
and this;
} while (this condition is true);
There is a minor difference between the working of while and do-while loops. This difference
lies in the place where the condition is tested. The while tests the condition before executing
any of the statements within the while loop. As against this, the do-while tests the condition
after having executed the statements within the loop. This means that do-while would execute
its statements at least once, even if the condition fails for the first time. The while, on the other
hand will not execute its statements if the condition fails for the first time.
Sum of n natural numbers (Using do-while loop)
#include <stdio.h>
void main()
{
int num, i, sum = 0; // initialize and declare the local variables
printf("Enter a positive number: ");
scanf("%d", &num); // take a value up to which find the sum of natural number
i = 0;
do
{
sum = sum + i; // store the sum of natural number
i++; // increment by 1
} while (i <= num); // define the while loop and i should be less than num
Q. What is address of i?
Q. What is value at i?
But we can’t use j in a program without declaring it. And since j is a variable that contains the
address of i, it is declared as,
int *j;
This declaration tells the compiler that j will be used to store the address of an integer value.
In other words, j points to an integer.
How do we justify the usage of * in the declaration?
int *j;
int *j would mean, the value at the address contained in j is an int.
Consider the following program:
main()
{
int i = 3 ;
int *j ;
j = &i ;
printf ( "\nAddress of i = %u", &i ) ;
printf ( "\nAddress of i = %u", j ) ;
printf ( "\nAddress of j = %u", &j ) ;
printf ( "\nValue of j = %u", j ) ;
printf ( "\nValue of i = %d", i ) ;
printf ( "\nValue of i = %d", *( &i ) ) ;
printf ( "\nValue of i = %d", *j ) ;
}
Address of i = 65524
Address of i = 65524
Address of j = 65522
Value of j = 65524
Value of i = 3
Value of i = 3
Value of i = 3
Functions in C:
A function is a self-contained block of statements that perform a coherent task of some kind.
main( )
{
message( ) ;
printf ( "\n2" ) ;
}
message( )
{
printf ( "\n1" ) ;
}
Output:
1
2
main( ) becomes the ‘calling’ function, whereas message( ) becomes the ‘called’ function.
Recursion
In C, it is possible for the functions to call themselves. A function is called ‘recursive’ if a
statement within the body of a function calls the same function. Sometimes called ‘circular
definition’, recursion is thus the process of defining something in terms of itself.
long factorial(int n)
{
if (n == 0)
return 1;
else
return(n * factorial(n-1));
}
void main()
{
int number;
long fact;
printf("Enter a number: ");
scanf("%d", &number);
fact = factorial(number);
printf("Factorial of %d is %ld\n", number, fact);
}
ARRAY:
Array is a collection of similar elements.
The first element in the array is numbered 0, so the last element is 1 less than the size of
the array. An array is also known as a subscripted variable. Before using an array, its type and
dimension must be declared. However big an array, its elements are always stored in
contiguous memory locations.
Array Declaration
int marks [30];
Here, int specifies the type of the variable, just as it does with ordinary variables and the word
marks specifies the name of the variable. The [30] however is new. The number 30 tells how
many elements of the type int will be in our array. This number is often called the ‘dimension’
of the array. The bracket [] tells the compiler that we are dealing with an array.
Accessing Elements of an Array
All the array elements are numbered, starting with 0. Thus, marks [2] is not the second element
of the array, but the third.
Array Initialisation