Professional Documents
Culture Documents
Programming in C
Course Code: ES202
MODULE -I
Ms. Garima Srivastava
Asstt. Professor
Dept Of CSE/IT ASET
AUUP Lucknow
What is Computer?
• A computer is a programmable electronic device that accepts
raw data as input and processes it with a set of instructions
(a program) to produce the result as output i.e information.
• It renders output just after performing mathematical and
logical operations and can save the output for future use.
• It can process numerical as well as non-numerical
calculations.
• Input-> Process-> Output
Data and Information
4
Functions of Computers
• A computer performs the following functions −
• Receiving Input
• Data is fed into computer through various input devices
like keyboard, mouse, digital pens, etc. Input can also be
fed through devices like CD-ROM, pen drive, scanner,
etc.
• Processing the information
• Operations on the input data are carried out based on the
instructions provided in the programs.
5
• Storing the information
• After processing, the information gets stored in the
primary or secondary storage area.
• Producing output
• The processed information and other details are
communicated to the outside world through output
devices like monitor, printer, etc.
6
Characteristics of the computer
system
7
• Speed
– A computer works with much higher speed and accuracy compared to
humans while performing mathematical calculations. Computers can
process millions (1,000,000) of instructions per second. The time taken by
computers for their operations is microseconds and nanoseconds.
• Accuracy
– Computers perform calculations with 100% accuracy. Errors may occur
due to data inconsistency or inaccuracy.
• Diligence
– A computer can perform millions of tasks or calculations with the same
consistency and accuracy. It doesn’t feel any fatigue or lack of
concentration. Its memory also makes it superior to that of human beings.
8
• Versatility
– Versatility refers to the capability of a computer to perform different kinds
of works with same accuracy and efficiency.
• Reliability
– A computer is reliable as it gives consistent result for similar set of data
i.e., if we give same set of input any number of times, we will get the same
result.
• Automation
– Computer performs all the tasks automatically i.e. it performs tasks
without manual intervention.
9
• Memory
– A computer has built-in memory called primary memory where
it stores data. Secondary storage are removable devices such
as CDs, pen drives, etc., which are also used to store data.
10
Application of computers
• Home
• Medical
• Scientific
• Entertainment
• Industry
• Education
• Government
• Banking
• Business
11
• Accounts
• Training
• Arts
• Designing
• Science and Engineering
• Simulation
12
Benefits
15
History of computer
• A computer can be defined as an electronic device that is designed to accept data, perform the
required mathematical and logical operation and give the result as an output.
• In today’s scenario, we find computer in most aspects of our daily lives. In the past, computer was
extremely large in size and often required an entire room for installation.
• These computers consumed enormous amount of power and were too expensive to be used for
commercial applications.
• Therefore, they were used for limited tasks, such as scientific or military applications.
16
• However, with technology improvement, the size of computers
become smaller and their energy requirements reduced
massively.
• This open the way for adoption of computers for commercial
persistence.
• These days, computers have become so prevalent in the market
that all interactive devices such as global positional system,
automatic teller machine, mobile phones etc. work with
computer.
17
Generations of Computers
First Generation (1940-1956)
• The first generation computers had the following features
and components −
• Hardware
– The hardware used in the first generation of computers was:
Vacuum Tubes and Punch Cards.
• Features
– Following are the features of first generation computers −
• It supported machine language.
• It had slow performance
18
• It occupied large size due to the use of vacuum tubes.
• It had a poor storage capacity.
• It consumed a lot of electricity and generated a lot of heat.
• Memory: The memory was of 4000 bits.
• Data Input: The input was only provided through hard-
wired programs in the computer, mostly through punched
cards and paper tapes.
• Examples: ENIAC, UNIVACTBM 701
19
20
Second Generation (1956-1963)
• Several advancements in the first-gen computers led to
the development of second generation computers.
Following are various changes in features and
components of second generation computers −
• Hardware
– The hardware used in the second generation of computers
were −
• Transistors
• Magnetic Tapes
21
• Features
– Batch operating system
– Faster and smaller in size
– Reliable and energy efficient than the previous generation
– Less costly than the previous generation
• Memory
– The capacity of the memory was 32,000 bits.
22
• Data Input
– The input was provided through punched cards.
• Examples
– Honeywell 400
– CDC 1604
– IBM 7030
23
24
Third Generation (1964-1971)
• Hardware
– Integrated Circuits made from semi-conductor materials
– Large capacity disks and magnetic tapes
• Features
– Supports time-sharing OS
– Faster, smaller, more reliable and cheaper than the previous
generations
– Easy to access
25
• Memory
– The capacity of the memory was 128,000 bits.
• Data Input
– The input was provided through keyboards and monitors.
• Examples−
– IBM 360/370
– CDC 6600
– PDP 8/11
26
27
Fourth Generation (1972-2010)
• Hardware
– ICs with Very Large Scale Integration (VLSI) technology
– Semiconductor memory
– Magnetic tapes and Floppy
– Features
– Multiprocessing & distributed OS
– Object-oriented high level programs supported
– Small & easy to use; hand-held computers have evolved
28
– No external cooling required & affordable
– This generation saw the development of networks and the
internet
– It saw the development of new trends in GUIs and mouse
• Memory
– The capacity of the memory was 100 million bits.
• Data Input
– The input was provided through improved hand held devices,
keyboard and mouse.
29
• Examples
• The examples of fourth generation computers are −
– Apple II
– VAX 9000
– CRAY 1 (super computers)
30
31
Fifth Generation (2010-Present)
32
• Features
– It supports features like −
– Powerful, cheap, reliable and easy to use.
– Portable and faster due to use of parallel processors and Super
Large Scale Integrated Circuits.
– Rapid software development is possible.
• Memory
– The capacity of the memory is unlimited.
33
• Data Input
– The input is provided through CDROM, Optical Disk and other
touch and voice sensitive input devices.
• Examples
– The examples of fifth generation computers are −
– IBM
– Pentium
– PARAM
34
35
Generations of Computers
40
Basically a computer can do many operations, e.g. it can:
• Store and retrieve numbers very quickly and very accurately.
• Add, subtract, multiply, and divide fast and accurately.
• Compare numbers
• Follow a list of instructions
• Jump around in the list.
• Everything else, like more complex mathematical operations,
interacting with peripheral devices like graphic cards, printers,
keyboards, mouse, joystick and other specialized devices,
maintaining large data files etc. is done by permutations and
combination of these basic operations mentioned above.
41
• In a computer system, everything is represented as numbers.
• Files, data in the files, instructions, addresses where data and
instructions are stored, any kind of text, everything is represented
using numbers.
• The first written description of how an electronic computer system
should store programs and process information had appeared in
john von Neumann report of the EDVAC(Electronic Discrete
Variable Automatic Computer) on June 30, 1945.
• This architecture comprises an arithmetic logic unit (ALU), control
unit, memory and input /output. This design is still in use in one
form or another in all computers and many other electronic
devices.
42
• John von Neumann envisioned the structure of a computer
system as being composed of the following components:
1. The central arithmetic unit, which today is called the ARITHMETIC LOGIC
UNIT (ALU) is a digital circuit used to perform arithmetic and logic
operations.
2. A control unit that directs other components of the computer to
perform certain actions, such as directing the fetching of data or
instructions from memory to be processed by the ALU.
43
3. In a computer's central processing unit (CPU), the accumulator is
a register in which intermediate arithmetic and logic results are
stored.
4. Machine interface, i.e. input and output devices, such as a
keyboard for input and display monitor for output
• Von Neumann was interested in presenting a logical description
of the stored program computer rather than an engineering
description. He was concerned with the overall structure of a
computing system, the abstract parts that comprise it, the
functions of each part, and how the parts interact to process the
information 44
According to him:
• Data and instructions are stored in a single read- write
memory.
• The contents of this memory are addressable by location,
regardless of the type of data contained there.
• Execution occurs in a sequential fashion (unless explicitly
modified from one instruction to the next. Of course,
computer technology has developed extensively since
von Neumann’s time.
45
• For instance, due to integrated circuitry and
miniaturization, the ALU and control unit have been
integrated onto the same microprocessor chip, becoming
an integrated part of the computer’s central processing
unit (CPU).
46
Memory
• Memory is that portion of a computer system that is used
for the storage and subsequent retrieval of data &
instruction, a typical computer system is equipped with a
hierarchy of memory system.
• Some are directly accessed by the CPU and some are
accessible by the CPU via the I/O interface. Memory can
be classified on the basis of properties like access or
storage or operations.
47
Main memory
• Main memory or Primary memory or Temporary memory:
The memory unit which is generally part of central
processing memory (memory unit) is temporary in nature.
Whatever the user stores on it remains till the power is
on. The contents are wiped off as soon as the power is
switched off. Hence, it is known as temporary memory or
primary memory.
48
• Permanent memory or Secondary memory:
• The memory which is normally attached as a peripheral
unit to the CPU is permanent in nature.
• Permanent means whatever the user writes on it remains
there even if the power is switched off.
• Unless the user deletes the data from secondary memory
it remains. Examples of secondary memory can be floppy
disk, hard disk, compact disk, magnetic tape etc.
49
Classification of memory based on Access
1.Sequential Access Memory (SAM): The data written in a
particular order in sequential access memory can always be
read or accessed in the same order. The data cannot be read or
accessed from in between or in random order. Example device
of such memory is magnetic tape.
2.Random Access Memory (RAM): The data written in a
particular order in random access memory can be read or
accessed randomly from anywhere in-between, for example,
devices like floppy disk or compact disk or hard disk.
50
Classification of memory on
the basis of read write
• Read Only Memory (ROM):
• The memory unit on which only read operation can be performed
is known as Read Only Memory.
• The writing on such memory happened at the time of
manufacturing of such memory units.
• The software in embedded systems which should not be changed
by the user is written on Read Only Memory units.
• Compact disks or CDs also come under Read Only category. But
special CD writers are now available in the market which helps
writing on compact disks more than one time (i.e. after
manufacturing time also). Still CDs are counted under ROM
51
category.
• Read/Write memory (R/W M):
• The memory unit on which both read and write operation
can be performed any time is known as Read/Write
Memory.
• Primary memory or main memory, floppy disks, hard
disks, magnetic tapes etc. are the examples of
Read/Write memory devices.
52
Types of Memory
• The memory unit of a computer is used to store data, instructions for
processing data, intermediate results of processing and the final
processed information. The memory units of a computer are classified as
primary and secondary memory.
• Primary Memory
•The primary memory is available in the computer as a built-in unit of
the computer.
• The primary memory is represented as a set of locations with each
location occupying 8 bits.
53
• Each bit in the memory is identified by unique address.
• The data is stored in the machine-understandable binary
form in these memory locations, commonly used primary
memories are as follows:
54
RAM:
• RAM is the read/write memory unit in which the
information is retained only as long as there is a regular
power supply.
• When the power supply is interrupted or switched off, the
information stored in the RAM is lost.
• RAM is volatile memory that temporarily stores data and
applications as long as they are in use.
• When the use of data or the application is over, the
content in RAM is erased.
55
ROM:
56
Cache memory:
57
Secondary Memory
• Secondary memory represents the external storage
devices that are connected to the computer.
• They provide non-volatile memory source used to store
information that is not in use currently.
• A storage device is either located in the CPU casing of
the computer or is connected externally to the computer.
58
• The secondary storage devices can be classified as:
• Magnetic storage device: The magnetic storage devices
store information that can be read, erased and rewritten a
number of times. These include floppy disk, hard disk and
magnetic tapes.
• Optical storage device: The optical storage devices are
secondary storage devices that use laser beams to read
the stored data. These include rewritable compact disk
(CD-RW), digital video disks with read only memory(DVD-
ROM), CD-ROM.
59