Unit-I Notes PPS
Unit-I Notes PPS
1. Input Unit
2. Output Unit
3. Storage Unit
4. Central Processing Unit (CPU)
5. Arithmetic and Logic Unit (ALU)
6. Control Unit
It accepts (or reads) the list of instructions and data from the outside world.
It converts these instructions and data in computer acceptable format.
It supplies the converted instructions and data to the computer system for further processing.
It accepts the results produced by the computer which are in coded form and hence cannot be
easily understood by us.
It converts these coded results to human acceptable (readable) form.
It supplied the converted results to the outside world.
The data and instructions that are entered into the computer system through input units have to be stored
inside the computer before the actual processing starts. Similarly, the results produced by the computer
after processing must also be kept somewhere inside the computer system before being passed on to the
output units. Moreover, the intermediate results produced by the computer must also be preserved for
ongoing processing. The Storage Unit or the primary / main storage of a computer system is designed to
do all these things. It provides space for storing data and instructions, space for intermediate results and
also space for the final results.
The main unit inside the computer is the CPU. This unit is responsible for all events inside the computer.
It controls all internal and external devices, performs “Arithmetic and Logical operations”. The operations
a Microprocessor performs are called “instruction set” of this processor. The instruction set is “hard
wired” in the CPU and determines the machine language for the CPU. The more complicated the
instruction set is, the slower the CPU works. Processors differed from one another by the instruction set.
If the same program can run on two different computer brands they are said to be compatible. Programs
written for IBM compatible computers will not run on Apple computers because these two architectures
are not compatible.
The control Unit and the Arithmetic and Logic unit of a computer system are jointly known as the Central
Processing Unit (CPU). The CPU is the brain of any computer system. In a human body, all major
decisions are taken by the brain and the other parts of the body function as directed by the brain.
Similarly, in a computer system, all major calculations and comparisons are made inside the CPU and
the CPU is also responsible for activating and controlling the operations of other units of a computer
system.
The arithmetic and logic unit (ALU) of a computer system is the place where the actual execution of the
instructions take place during the processing operations. All calculations are performed and all
comparisons (decisions) are made in the ALU. The data and instructions, stored in the primary storage
prior to processing are transferred as and when needed to the ALU where processing takes place. No
processing is done in the primary storage unit. Intermediate results generated in the ALU are temporarily
transferred back to the primary storage until needed at a later time. Data may thus move from primary
storage to ALU and back again as storage many times before the processing is over. After the completion
of processing, the final results which are stored in the storage unit are released to an output device.
While performing these operations the ALU takes data from the temporary storage are inside the CPU
named registers. Registers are a group of cells used for memory addressing, data manipulation and
processing. Some of the registers are general purpose and some are reserved for certain functions. It is a
high-speed memory which holds only data from immediate processing and results of this processing. If
these results are not needed for the next instruction, they are sent back to the main memory and registers
are occupied by the new data used in the next instruction.
All activities in the computer system are composed of thousands of individual steps. These steps should
follow in some order in fixed intervals of time. These intervals are generated by the Clock Unit. Every
operation within the CPU takes place at the clock pulse. No operation, regardless of how simple, can be
performed in less time than transpires between ticks of this clock. But some operations required more
than one clock pulse. The faster the clock runs, the faster the computer performs. The clock rate is
measured in megahertz (Mhz) or Gigahertz (Ghz). Larger systems are even faster. In older systems the
clock unit is external to the microprocessor and resides on a separate chip. In most modern
microprocessors the clock is usually incorporated within the CPU.
How the input device knows that it is time for it to feed data into the storage unit? How does the ALU
know what should be done with the data once it is received? And how is it that only the final results are
sent to the output devices and not the intermediate results? All this is possible because of the control unit
of the computer system. By selecting, interpreting, and seeing to the execution of the program
instructions, the control unit is able to maintain order and directs the operation of the entire system.
Although, it does not perform any actual processing on the data, the control unit acts as a central nervous
system for the other components of the computer. It manages and coordinates the entire computer
system. It obtains instructions from the program stored in main memory, interprets the instructions, and
issues signals that cause other units of the system to execute them.
The control unit directs and controls the activities of the internal and external devices. It interprets the
instructions fetched into the computer, determines what data, if any, are needed, where it is stored,
where to store the results of the operation, and sends the control signals to the devices involved in the
execution of the instructions.
Computer memory is any physical device capable of storing information temporarily like RAM
(random access memory), or permanently, like ROM (read-only memory). Memory devices utilize
integrated circuits and are used by operating systems, software, and hardware.
Memory in computers is basically divided into two parts:-
2.1.4 SD card
2.1.5 CD
2.1.6 DVD
2.1.7 Floppy diskette – Figure below shows a floppy drive & inside a floppy drive
3. PROCESSOR IN A COMPUTER
A processor (CPU) is the logic circuitry that responds to and processes the basic instructions that drive a
computer. The CPU is seen as the main and most crucial integrated circuitry (IC) chip in a computer, as it
is responsible for interpreting most of computers commands. CPUs will perform most basic arithmetic,
logic and I/O operations, as well as allocate commands for other chips and components running in a
computer.
The term processor is used interchangeably with the term central processing unit (CPU), although strictly
speaking, the CPU is not the only processor in a computer. The GPU (graphics processing unit) is the most
notable example, but the hard drive and other devices within a computer also perform some processing
independently. Nevertheless, the term processor is generally understood to mean the CPU.
3.1.4 L1 and L2cache memory: Their inclusion in the CPU saves time compared to having to get data
from random access memory (RAM). Figure shows L1 & L2 cache attachment below:
4.1.1 Fetch- is the operation which receives instructions from program memory from a systems RAM.
4.1.2 Decode- is where the instruction is converted to understand which other parts of the CPU are
needed to continue the operation. This is performed by the instruction decoder
4.1.3 Execute- is where the operation is performed. Each part of the CPU that is needed is activated
to carry out the instructions.
The processor in a personal computer or embedded in small devices is often called a microprocessor.
That term means that the processor's elements are contained in a single IC chip. Some computers will
operate using a multi-core processor—a chip containing more than one CPU. A CPU is typically a small
device with pins on it facing down in a motherboard. CPUs can also be attached to a motherboard with a
heat sink and a fan to dissipate heat.
4.2.1 TYPES OF PROCESSORS
Every PC has a Central Processing Unit (CPU) this acts as the brain of your system. It connects to the
Motherboard and works alongside the other components processing many instructions at the same time
between the different hardware and memory systems.
Advancements in CPU technology now mean systems typically come at least Dual Core, Quad Core or
more processors (on one single chip) instead of the traditional one core per chip. Now the total number
of Cores can slot into a socket as before and a single heat sink and fan can keep everything to the right
temperature.
The Intel Pentium processors with Intel dual-core technology deliver great desktop performance, low
power enhancements, and multitasking for everyday computing.
Intel Core i3 dual core processors provide 4-way multitasking capability, runs at fixed speed ideal for
typical tasks and media playback but not games.
Intel i5 usually quad core but some dual processors deliver the next level of productivity. Mostly the
same as i3 but with Intel Turbo Boost Technology, delivers extra speed when you need it. Like the i3
integrated graphics is included but is only ideal for normal use not for gaming.
Intel i7 processors dual or quad core for the most demanding applications with cache and faster clock
speeds. Quad-core processors feature 8-way threading, four cores will run faster, and more L3 cache,
but will consume more power. High-end use, video and gaming with dedicated video card.
Most modern CPUs use an instruction queue. Several instructions are waiting in the queue, ready to be
executed. Separate electronic circuitry keeps the instruction queue full while the control unit is executing
the instructions. But this is simply an implementation detail that allows the control unit to run faster. The
essence of how the control unit executes a program is represented by the single instruction register
model.
Since instructions are simply bit patterns, they can be stored in memory. The instruction pointer register
always has the memory address of (points to) the next instruction to be executed. In order for the control
unit to execute this instruction, it is copied into the instruction register.
This is a multi-step process using several programs. The programs and the files that each create
are:
1) An editor is used to create source files. (As you have done in C Programming Editor by
writing a program)
The source file is written in a programming language, e.g., C/C++. This is very similar to
creating a file with a word processor. The main difference is that an editor is based on
plain characters, while a word processor formats the text. You see all the characters that
you type in an editor, but a word processor includes many hidden formatting codes that
define things like paragraphs, bold font, etc.
2) A compiler or assembler is used to create object files. (In C a .obj file is created)
The compiler or assembler translates the programming language in a source file into the
bit patterns that can be used by a CPU (machine language). The source file contents
remains unchanged.
3) A linker is used to create an executable file. (In c a .exe file is created)
Most programs are made up of several object files. For example, a GNU/Linux installation
includes many object files that contain the machine instructions to perform common
tasks. These are programs that have already been written and compiled. Related tasks
are commonly grouped together into a single file called a library.
4) In-built Library functions: - Whenever possible, you should use the short programs in
these libraries to perform the computations your program needs rather that write it
yourself. The linker program will merge the machine code from these several object files
into one executable file.
The first task is very important i.e. managing the hardware and software resources, as
various processes compete to each other for getting the CPU time and memory space to
complete the task. In this regard; the operating system acts as a manager to allocate the
available resources to 'satisfy the requirements of each process.
The second task i.e. providing a consistent application interface is especially important.
A consistent application program interface (API) allows a user (or S/W developer) to write
an application program on any computer and to run this program on another computer,
even if the hardware configuration is different like as amount of memory, type of CPU or
storage disk. It shields the user of the machine from the low-level details of the machine's
operation and provides frequently needed facilities.
Lexer : A program that performs lexical analysis may be termed a lexer, tokenizer, or
scanner, though scanner is also a term for the first stage of a lexer. A lexer is generally
combined with a parser, which together analyze the syntax of programming languages,
web pages, and so forth
Parser: A parser is a compiler or interpreter component that breaks data into smaller
elements for easy translation into another language. A parser takes input in the form of a
sequence of tokens or program instructions and usually builds a data structure in the form
of a parse tree or an abstract syntax tree.
8. ALGORITHM
It is a process or set of rules to be followed in calculations or other problem-solving
operations, especially by a computer.
9. FLOWCHART
A flowchart is a type of diagram that represents a workflow or process. A flowchart can
also be defined as a diagrammatic representation of an algorithm, a step-by-step
approach to solving a task. The flowchart shows the steps as boxes of various kinds, and
their order by connecting the boxes with arrows.
Symbols used in a flowchart are:-
Terminator(Start/Stop):
The terminator symbol represents the starting or ending point of the system.
Process
A box indicates some particular operation.
Document
This represents a printout, such as a document or a report.
Decision
A diamond represents a decision or branching point. Lines coming out from the
diamond indicates different possible situations, leading to different sub-processes.
aa Yes
No
On-Page Reference
This symbol would contain a letter inside. It indicates that the flow continues on a
matching symbol containing the same letter somewhere else on the same page.
Off-Page Reference
This symbol would contain a letter inside. It indicates that the flow continues on a
matching symbol containing the same letter somewhere else on a different page.
Delay or Bottleneck
Identifies a delay or a bottleneck.
Flow
Lines represent flow of the sequence and direction of a process.
Draw flowchart to find the largest among three different numbers entered by user.
10. PSEUDOCODE
It is an informal high-level description of the operating principle of a computer program
or other algorithm. A typical pseudocode must have following characteristics.
It uses the structural conventions of a normal programming language, but is intended
for human reading rather than machine reading.
It typically omits details that are essential for machine understanding of the algorithm,
such as variable declarations, system-specific code and some subroutines.
The programming language is augmented with natural language description details,
where convenient or with compact mathematical notation.
The purpose of using pseudocode is that it is easier for people to understand than
conventional programming language code, and that it is an efficient and environment-
independent description of the key principles of an algorithm.
It is commonly used in textbooks and scientific publications that are documenting
various algorithms, and also in planning of computer program development, for
sketching out the structure of the program before the actual coding takes place.
Start Program
Enter two numbers, A, B
Add the numbers together
Print Sum
End Program
*****