Professional Documents
Culture Documents
CP Unit 1 Notes
CP Unit 1 Notes
CP Unit 1 Notes
The term computer is derived from the word compute. The word
compute means to calculate. A computer is an electronic machine that
accepts data from the user, processes the data by performing calculations
and operations on it, and generates the desired output results.
Characteristics of Computer:
Speed: The computer can process data very fast, at the rate of millions of
instructions per second.
Diligence: When used for a longer period of time, It can perform long and
complex calculations with the same speed and accuracy from the start till
the end.
Reliability: It is measurement of performance of a computer, which is
measured against pre determined standards for operation without any
failure.
GENERATION OF COMPUTERS
First Generation:
Application They were used for scientific applications as they were the
fastest computing device of their time.
The first generation computers used a large number of vacuum tubes and
thus generated a lot of heat. They consumed a great deal of electricity and
were expensive to operate. The machines were prone to frequent
malfunctioning and required constant maintenance. Since first generation
computers used machine language, they were difficult to program.
Second Generation:
Second generation computers generated a lot of heat but much less than
the first generation computers. They required less maintenance than the
first generation computers.
Third Generation:
Hardware Technology The third generation computers used the
Integrated Circuit (IC) chips. Consist of single chip with many
components such as transistors, resistors & capacitors fabricated on it.
Punched cards & printouts are replaced by keyboards & monitors &
interfaced with operating system. Magnetic disks were used for secondary
storage.
The third generation computers used less power and generated less heat
than the second generation computers. The cost of the computer reduced
significantly, as individual components of the computer were not required
to be assembled manually. The maintenance cost of the computers was also
less compared to their predecessors.
Fourth Generation:
Hardware Technology
They use the Large Scale Integration (LSI) and the Very Large Scale
Integration (VLSI) technology. Thousands of transistors are integrated on
a small silicon chip using LSI technology. VLSI allows hundreds of
thousands of components to be integrated in a small chip. ULSI increased
that number into millions.
Uses an extension of third generation technology of this generation is
based on IC But these have been made readily available because of
development of the microprocessor (Circuit containing millions of
transistors).
Magnetic core memories were substituted by semiconductor memories
resulted in RAM.
Secondary memories –hard disk became economical, smaller & bigger in
capacity.
CLASSIFICATION OF COMPUTER
Based on applications:
General purpose computers: can work in all environments.
Special purpose computers: can perform only a specified task.
Micro-computer
Laptops (Notebook):
Same as PCs in functionality
More Compact, Portable
Less Power requirement, operated on battery/s
Less capacity compared to PCs
Maintenance and actually are costlier compared to PCs
Theft prone
Netbook:
These are smaller notebooks optimized for low weight and low cost,
and are designed for accessing web-based applications.
Tablet Computer:
It has features of the notebook computer but it can accept input from
a stylus or a pen instead of the keyboard or mouse.
It is a portable computer.
Minicomputers
Mainframe Computer
Mainframe computers are multi-user, multi-programming and high
performance computers.
They operate at a very high speed, have very large storage capacity
and can handle the workload of many users.
Mainframe computers are large and powerful systems generally used
in centralized databases.
It can support hundreds or thousands of users using the feature of
time sharing supported by systems like Linux.
Mainframes can concurrently run multiple programs even with a
single CPU. The processor speed in a mainframe is measured in
MIPS (million instructions per second).
The user accesses the mainframe computer via a terminal that may
be a dumb terminal, an intelligent terminal or a PC. A dumb
terminal cannot store data or do processing of its own. It has the
input and output device only. An intelligent terminal has the input
and output device, can do processing, but, cannot store data of its
own. The dumb and the intelligent terminal use the processing power
and the storage facility of the mainframe computer.
Mainframe computers are used in organizations like banks or
companies, where many people require frequent access to the same
data, on-line processing of large number of transactions & require
computer systems which have massive data storage & processing
capabilities.
Some examples of mainframes are CDC 6600 and IBM ES000 series.
Super Computers
Supercomputers are the fastest and the most expensive machines.
They have high processing speed compared to other computers.
The speed of a supercomputer is generally measured in FLOPS
(Floating point Operations per Second).
Some of the faster supercomputers can perform trillions of
calculations per second. A supercomputer uses multiple CPUs for
parallel data processing, which means portions of the same program
are handled independently by multiple processors.
Supercomputers are used for highly calculation-intensive tasks, such
as, weather forecasting, Analysis of geological data, climate research
(global warming), molecular research, biological research, nuclear
research and aircraft design.
They are also used in major universities, military agencies and
scientific research laboratories.
Some examples of supercomputers are IBM Roadrunner, IBM Blue
gene and Intel ASCI red.
PARAM is a series of supercomputer assembled in India by C-DAC
(Center for Development of Advanced Computing), in Pune. PARAM
Padma is the latest machine in this series. The peak computing
power of PARAM Padma is 1 Tera FLOP (TFLOP).
The user interacts with the computer via the I/O unit. The Input unit
accepts data from the user, into a form that is understandable by the
computer. Input devices are classified as follows
Human data entry devices
Input devices that require data to be entered manually to the computer are
identified as human data entry devices.
Keyboard
Pointing devices—mouse, trackball, joystick, digitizing tablet
Pick devices—light pen, touch screen
Source data entry devices
Source data entry devices do not require data to be typed-in, keyed-in or
pointed to a particular location.
Audio input—speech recognition
Video input—digital camera
Scanner—hand-held scanner, flat-bed scanner
Optical Scanner—OCR, OMR, MICR, barcode reader
Output unit
Output devices provide output to the user, which is generated after
processing the input data.
The processed data, presented to the user via the output devices
could be text, graphics, audio or video.
Output devices are classified as follows
Hard Copy Devices
The output obtained in a tangible form on a paper or any surface is called
hard copy output.
Printer
Plotter
Computer Output on Microfilm (microfiche)
Soft Copy Devices
The output obtained in an intangible form on a visual display, audio unit or
video unit is called soft copy output.
Monitor
Visual Display Terminal
Video Output
Audio Response
Control Arithmeti
Unit c Logic
Unit
Registers
Primary Memory
Primary memory is the main memory of computer. It is used to store
data and instructions during the processing of data. Primary memory
is semiconductor memory.
Primary memory is of two kinds—Random Access Memory (RAM) and
Read Only Memory (ROM).
RAM is volatile. It stores data when the computer is on. The
information stored in RAM gets erased when the computer is turned
off. RAM provides temporary storage for data and instructions.
ROM is non-volatile memory, but is a read only memory. The storage
in ROM is permanent in nature, and is used for storing standard
processing programs that permanently reside in the computer. ROM
comes programmed by the manufacturer.
RAM stores data and instructions during the execution of instructions.
The data and instructions that require processing are brought into the
RAM from the storage devices like hard disk. CPU accesses the data
and the instructions from RAM, as it can access it at a fast speed than
the storage devices connected to the input and output unit.
The input data that is entered using the input unit is stored in RAM,
to be made available during the processing of data. Similarly, the
output data generated after processing is stored in RAM before being
sent to the output device. Any intermediate results generated during
the processing of program are stored in RAM.
RAM provides a limited storage capacity, due to its high cost.
Secondary Memory
The secondary memory stores data and instructions permanently. The
information can be stored in secondary memory for a long time
(years), and is generally permanent in nature unless erased by the
user. It is a non-volatile memory.
It provides back-up storage for data and instructions. Hard disk drive,
floppy drive and optical disk drives are some examples of storage
devices.
The data and instructions that are currently not being used by CPU,
but may be required later for processing, are stored in secondary
memory.
Secondary memory has a high storage capacity than the primary
memory.
Secondary memory is also cheaper than the primary memory.
It takes longer time to access the data and instructions stored in
secondary memory than in primary memory.
Magnetic tape drives, disk drives and optical disk drives are the
different types of storage devices.
Instruction
A computer program is a set of instructions that describe the steps to
be performed for carrying out a computational task. The program and
the data, on which the program operates, are stored in main memory,
waiting to be processed by the processor. This is also called the stored
program concept.
A processor has a set of instructions that it understands, called as
instruction set.
The primary responsibility of a computer processor is to execute a
sequential set of instructions that constitute a program. CPU executes
each instruction in a series of steps, called instruction cycle.
Fetching: The processor fetches the instruction from the memory.
The fetched instruction is placed in the Instruction Register.
Program Counter holds the address of next instruction to be
fetched and is incremented after each fetch.
Decoding: The instruction that is fetched is broken down into
parts or decoded. The instruction is translated into commands so
that they correspond to those in the CPU’s instruction set. The
instruction set architecture of the CPU defines the way in which
an instruction is decoded.
Executing: The decoded instruction or the command is executed.
CPU performs the operation implied by the program instruction.
For example, if it is an ADD instruction, addition is performed.
Storing: CPU writes back the results of execution, to the
computer’s memory.
A CPU performance is measured by the number of instructions it
executes in a second, i.e., MIPS (million instructions per second), or
BIPS (billion instructions per second).
Part of the computer that are responsible for processing or converting
data into meaningful information.
Processor
Buses
System Clock
Processor
CPU referred to as a Processor Performs processing and control
activities performed by different parts of computer.
Buses
Electrical pathway that transfer data and instructions among
different parts of computer.
Main memory is directly/indirectly connected to the processor via a
bus.
Data Bus - Data bus is Bidirectional because the Microprocessor
can read data from memory or write data to the memory.
Address Bus - Address bus is Unidirectional because the
microprocessor is addressing a specific memory location.
Control Bus – Control the activities all the software's and
hardware’s
System Clock – Clock used to synchronizing the activities performed by
the computer.
Factors that affect the performance of the computer
Registers - The bigger the size, the more quickly it can process data.
RAM - Larger the RAM size when the computer is switched on, the
operating system, device drivers, the active files and running programs are
loaded into RAM is very fast.
System Clock- Higher clock frequencies mean more clock ticks per
second. A CPUs performance is measured by the number of instructions it
executes in a second
Bus - The data bus width affects the speed of computer.
Cache memory – Size (amount of cache memory) and level L1, L2 and L3.
Larger the size of cache, the better it is. PCs nowadays have a L1 cache of
256KB and L2 cache of 1MB.
Computer Language
Low-Level Languages:
• Supports low level tasks such as transferring data from memory to
disk, or rendering text onto a display.
• Low level language is machine dependent i.e. a program written for
one type of computer does not work on other computers.
Machine Language –
• First Generation Language Instructions are represented by
combinations of 0’s and 1’s.
• Machine languages are the only languages understood by computers.
Assembly Language –
• Second Generation Language. Machine language instructions are
replaced with simple pneumonic abbreviations (e.g. ADD, MUL, DIV
etc…).
• Computer can’t execute it directly. Programs need to translate into
machine language to run. Assembler translates assembly language
into Machine codes.
High-Level Languages:
• Any language that is independent of the machine such as C, C++,
and Java.
• High level languages uses English like statements and mathematical
notations.
SOFTWARE
System Software
System software is "Background" software that helps the computer
manage its own internal resources.
It enables the application software to interact with the computer
hardware. E.g. Operating System, Device Drivers, Utility Software,
and Translators etc...
Most system software is run by the computer on startup, first from a
ROM and then from the hard disk. The others are invoked when
programs need them, say, for printing a report. In some cases, a user
may also directly use a program of this type. System software
includes but is not restricted to the following:
Application Software
Program Logic
• Logic is a just an idea or a blue print for a part of a program which
consists of set of instructions to solve the given problem.
• Logic of the program consists of the statements which will be then
converted into programming language statements that will be
executed by the computer in order to solve the problem.
Problem formulation:
Top down analysis: Subdivide the large problem into several small tasks
or parts for ease of analysis.
Two essential ideas in top down analysis:
Subdivision of a problem
Hierarchy of tasks
Four steps in top down analysis:
Step 1: Define the complete scope of the problem to determine the basic
requirement for its solutions.
Input: what data is required to be processed by the program?
Process: What must be done with the input data? What type of processing
is required?
Output: What information should the program produce? In what form
should it be presented?
Step 2: Based on the definition of the problem, divide the problem into two
or more parts/tasks.
Step 3: Define the scope of ease of these tasks and subdivide them further
if necessary, divide into two or more smaller tasks.
Step 4: Repeat step 3 at lowest level describes a simple tasks, which
cannot be broken further.
Algorithms
An algorithm is a
well organized,
Set of step-by-step instructions that perform a specific task or
operation
Natural language NOT programming language
It helps the programmer in breaking down the solution of a problem into a
number of sequential steps.
Features:
Finiteness. An algorithm must always terminate after a finite
number of steps.
Definiteness. Each step of an algorithm must be precisely defined;
the actions to be carried out must be rigorously and unambiguously
specified for each case.
Input. An algorithm has zero or more inputs, i.e., quantities which
are given to it initially before the algorithm begins.
Output. An algorithm has one or more outputs i.e, quantities which
have a specified relation to the inputs.
Effectiveness. An algorithm is also generally expected to be
effective. This means that all of the operations to be performed in the
algorithm must be sufficiently basic that they can in principle be done
exactly and in a finite length of time.
Properties of an algorithm:
No ambiguity
No uncertainty about which instruction to be executed next(written
in sequence)
Conclude after a finite number of steps(algorithm will terminate)
General enough to deal with any contingency
Factors used to measure the algorithm:
Time
Memory
Accuracy
Sequence etc,.
Flowcharts:
It is the pictorial representation of an algorithm in which steps are
drawn in the form of different shapes of boxes and the logical flow is
indicated by interconnecting arrows.
Boxes represent operations
Arrows represent sequence in which operations are implemented
Primary purpose : help programmer in understanding the logic
Flowchart=Blue print of building
Flowchart Symbols:
Terminal symbol
It is used to represent the start, end of the program logic.
Input/output
It is used for input or output.
Process Symbol
It is used to represent the calculations, data movements,
initialization ope rations etc,.
Decision Symbol
It is used to denote a decision to be made at that point
Flow lines
It is used to connect the symbols
Connectors
It is used to connect the flow lines.
Loop
It is used to denote loops involved in the process.
Benefits of Flowcharts:
Makes logic clear
Communication: Flowcharts are better way of communicating the
logic of a system
Effective analysis: Problem can be analyzed in more effective way.
Proper documentation: Flowcharts serve as a good program
documentation
Efficient Coding: Flowcharts act as a guide or blueprint during the
systems analysis and program development phase.
Proper testing and Debugging: Flowchart helps in debugging
process.
Efficient Program Maintenance: The maintenance of operating
program becomes easy with the help of flowchart.
Sequence
All the instructions are executed one after another is called sequence
execution.
Example: Add two numbers
Step 1: Start
Step 2: get a,b
Step 3: Calculate c=a+b
Step 4: Display c
Step 5: Stop
Selection
Mainfunction()
Step 1: Start
Step 2: Call the function add()
Step 3: Stop
Step1:Function start
Step2:Get a,b Values
Step 3: add c=a+b
Step 4: Print c
Step 5: Return
Examples:
Algorithm Flowchart Pseudocode
Addition of two numbers
Step1: Start READ a,b
Step2: Read two C=a+b
numbers say a, b WRITE C
Step3: Add the value of STOP
a with b and store the
result in c.
Step4: Display the
value of c
Step5: Stop
Odd or even
Step 1:Start START
Step 2: read a Number READ number
Step 3:if (Number%2) IF number MOD 2=0 THEN
is 0,Print/Show as DISPLAY “ Even Number”
even number else ELSE
show as odd number DISPLAY “Odd Number”
Step 4: Stop END IF
STOP
Largest number among 3 numbers
Step1: Start READ a, b, c
Step2: Read the IF (a>b) and (a>c) THEN
value of a, b, c WRITE a is largest
Step3: Check if ELSE IF (b>c) THEN
(a>b) and (a>c) WRITE b is largest
then, print a is ELSE
largest WRITE c is largest
else check if (b>c) ENDIF
then, print b is STOP
largest
else
print c is largest
Step4: Stop