Computer Programming
CHAPTER 1
INTRODUCTION TO COMPUTER
Computer
A computer is an electronic device that processes data, performs
calculations, and executes instructions to perform various tasks.
It is a programmable machine that can store, retrieve, and
manipulate data (input), as well as perform complex operations
quickly and accurately.
It produces information (output), and store the information for
future use
Functionalities of a computer
Any digital computer carries out five functions in gross terms:
Take data as input
Stores data/instructions In memory and use when required
Process the data and converts into useful information
Generates the output
Control all the above four steps
Computer Components
Any kind of computers consists of HARDWARE AND SOFTWARE.
Hardware
Computer hardware is the collection of physical
elements that constitutes a computer system.
Computer hardware refers to the physical parts
or components of a computer such as the
monitor, mouse, keyboard, computer data
storage, hard drive disk (HDD), system unit
(graphic cards, sound cards, memory,
motherboard and chips), etc.
All of which are physical objects that can be
touched.
Input Devices
Input devices are devices that allow
users to input data or commands into a
computer or other electronic device.
These devices enable users to interact
with and control the device or
software they are using.
Most common are keyboard and mouse
Output devices
An output device is any piece of
computer hardware equipment used
to communicate the results of data
processing carried out by an
information processing system (such
as a computer) which converts the
electronically generated information
into human-readable form
Primary Memory
Random Access Memory (RAM):
It is volatile in nature, which means that data
will be erased once supply to the storage device
is turned off.
RAM stores data randomly and the processor
accesses these data randomly from the RAM
storage.
RAM is considered "random access" because you
can access any memory cell directly if you know
the row and column that intersect at that cell
Primary Memory
Read Only Memory (ROM):
ROM is a permanent form of storage.
ROM stays active regardless of
whether power supply to it is turned
on or off.
ROM devices do not allow data
stored on them to be modified
Secondary Memory
Stores data and programs permanently, its
retained after the power is turned off:
Hard drive (HD): A hard disk is part of
a unit, that store and provides relatively
quick access to large amounts of data.
These disks are coated with a magnetic
material, and data is stored on them in
the form of magnetic patterns.
Secondary Memory (cont.)
Optical Disk: an optical disc drive (ODD) is a disk drive that
uses laser light as part of the process of reading or writing
data to or from optical discs (ex. CDs or DVDs).
Flash Disk are portable storage devices that use flash
memory to store and transfer data. They are small,
lightweight, and connect to computers and other devices via
a USB (Universal Serial Bus) interface.
12
Instructions
Instructions specify commands to:
Transfer information within a computer (e.g., from memory
to ALU)
Transfer of information between the computer and I/O
devices (e.g., from keyboard to computer, or computer to
printer)
Perform arithmetic and logic operations (e.g., Add two
numbers, Perform a logical AND).
13
Instructions (cont.)
A sequence of instructions to perform a task is called a
program, which is stored in the memory.
Processor fetches instructions that make up a program from
the memory and performs the operations stated in those
instructions.
Instruction Example:
add a,b,c
14
Data
Data are the “operands” upon which instructions operate.
Data could be:
Numbers,
Encoded characters.
Data means any digital information.
Computers use data that is encoded as a string of binary digits
called bits.
Central Processing Unit (CPU)
A CPU (processor) is brain of a computer
It is responsible for all functions and processes.
Regarding computing power, the CPU is the most important element
of a computer system.
The CPU is comprised of three main parts :
1. Arithmetic Logic Unit (ALU)
2. Control Unit (CU)
3. Registers
Arithmetic Logic Unit (ALU)
Executes all arithmetic and logical operations.
Arithmetic calculations like as addition,
subtraction, multiplication and division.
Logical operation like compare numbers,
letters, or special characters
17
Control unit
Operation of a computer can be summarized as:
Accepts information from the input units (Input unit).
Stores the information (Memory).
Processes the information (ALU).
Provides processed results through the output units
(Output unit).
Control Unit (CU)
Operations of Input unit, Memory, ALU and Output unit are
coordinated by Control unit.
Instructions control “what” operations take place (e.g. data
transfer, processing).
Control unit generates timing signals which determines “when”
a particular operation takes place.
Registers
Register is a very fast computer memory used to speed the
execution of computer programs
Registers are the top of the memory hierarchy, and are the
fastest way for the system to manipulate data.
They are normally measured by the number of bits they can
hold, for example, an “8-bit register” or a “32-bit register”,
actually according to the memory word size
Buses
• For a computer to achieve its operation, the functional units need to
communicate with each other.
• Functional units may be connected by a group of parallel wires.
• The group of parallel wires is called a bus.
• Each wire in a bus can transfer one bit of information.
• The number of parallel wires in a bus is equal to the word length of a
computer
Input Output Memory Processor
Bus
21
Software
Applications software
Systems software
Hardware
System Software
Operating system – supervising program that interfaces the user’s
program with the hardware (e.g., Linux, MacOS, Windows)
Handles basic input and output operations
Allocates storage and memory
Provides for protected sharing among multiple applications
Compiler – translate programs written in a high-level language (e.g.,
C, Java) into instructions that the hardware can execute
Application Software
Application software, also known as applications or apps,
refers to computer programs or software designed to perform
specific tasks or provide specific functionality for users.