CS22101 - Unit 01 Notes
CS22101 - Unit 01 Notes
Functions / Operations
• Accepting Data or instructions
(Input)
• Storing Data
• Processing Data
• Display Result (Output)
• Controlling and Coordinating all
operations
Components and Functions of Computer
Components and Functions of Computer
Components
• Input
• Storage
• Processing
• Output
Components and Functions of Computer
Input
• Process of entering data and
instructions into computer
• Convert the input data into zeros
and ones.
• Example: Keyboard, Mouse,
Scanner, Joy-Stick, Trackball etc.
Components and Functions of Computer
Storage
• Process of saving data and
instructions permanently used for
processing.
• Supports intermediate results / final
results.
• Types
– Primary
– Secondary
Components and Functions of Computer
Storage
• Primary
– Main Memory
– Directly accessible by processor with
high speed.
– Store data , program and
intermediate results.
– Very Expensive and Limited
Capacity
– Volatile in nature : When the power
off data will be erased.
– Eg. Random Access Memory (RAM)
Components and Functions of Computer
Storage
• Secondary
– Auxiliary Memory / Permanent
Storage
– Non Volatile
– Permanently store data and
programs which are not being
currently executed by CPU.
– Storage Capacity is high.
– E.g. Magnetic Disk (HDD)
Components and Functions of Computer
Processing
• Performing operations on the data as
per the instructions provided by the
user.
• Transform the data into information
• Fetch data and instructions from
primary memory and transferred to
ALU (Arithmetic and Logical Unit) to
perform calculations.
• Transfer the final result to main
memory.
Components and Functions of Computer
Output
• Giving the result of data processing to
the outside of world.
• Reverse of input.
• Converts the 0’s and 1’s (binary) into
human readable language.
• Eg. Monitor, Printer Etc.
Components and Functions of Computer
Controlling
• Managing, Coordinating, Controlling
all the components of computer system.
• Part of CPU.
• Decides the manner in which the
instruction will be executed and the
operations will be performed.
Hardware and Software
Hardware
• All the physical parts of the computer that can
be touched.
• Eg. Input, Output and Storage devices.
Software
• Set of instructions arranged in a sequence to
guide a computer to find a solution for the
given problem.
Or
• Software is a set of programs (sequence of
instructions) that allows the users to perform
a well-defined function or some specified task
• The process of writing a program is called
programming.
Hardware and Software
Hardware
• All the physical parts of the computer that can
be touched.
• Eg. Input, Output and Storage devices.
Software
• Set of instructions arranged in a sequence to
guide a computer to find a solution for the
given problem.
Or
• Software is a set of programs (sequence of
instructions) that allows the users to perform
a well-defined function or some specified task
• The process of writing a program is called
programming.
Hardware and Software
Hardware : CPU
Hardware and Software
Hardware : CPU
• Brain of the computer.
• Processing of instructions and
execution done by CPU.
• Made up of one or more
microprocessors.
• Contains
– Arithmetic and Logical Unit (ALU)
– Control Unit (CU)
– Registers
– Bus interface unit.
Hardware and Software
Arithmetic and Logical Unit (ALU)
• Performs arithmetic (add, subtract,
multiply, divide etc.) , comparison (less
than, greater than or equal to ) and
other operations.
• Intermediate results stored at primary
memory.
• Return the final results to main
memory once the process is over.
• Data may move from main memory to
ALU unit multiple times before the
completion.
Hardware and Software
Control Unit
• Direct and Coordinate computer
operations.
• Responsible for fetching, decoding,
executing instructions and storing results.
• Interprets the instruction (program) and
initiates actions to execute them.
• Controls the flow of data in the computer
system and directs the ALU,I/O devices
and other units.
• Central Nervous System of computer
system
Hardware and Software
Registers
• Processor register provides quick
access to the data currently being used
for processing.
• Temporary and Final results are
stored.
• Used to speed up program execution.
• Store the instructions of the program
currently being executed.
Hardware and Software
Accumulator and General Purpose Register
• Used frequently to store data bought
from main memory and store
intermediate results.
• Final results transferred from
accumulator to the main memory
through memory buffer register(MBR)
• Number of registers will varies from
processor to processor.
Hardware and Software
Special Purpose Register
• Memory Address Register (MAR) stores the
address of data or instruction fetched from
the main memory.
• Address value copied from program counter
(PC).
• Memory Buffer Register (MBR)
– Stores the data or instruction fetched
from the main memory.
– If instruction is copied then content will
be copied into Instruction Register(IR).
– If data/content is copied that will be
transferred either accumulator or I/O
register.
Hardware and Software
Special Purpose Register
• MBR also used for writing the content to main
memory.
• IR stores the instructions currently being
executed.
• Instruction : Operation + Address of Data.
• IR is loaded with an instruction then the address
of data will be transferred to MAR and operation
part transfer to CU for interpretation and
execution.
• I/O register is used to transfer data/instructions to
or from an I/O device.
• Sent data to output device via writing in this
register.
• PC stores the address of the next instruction to be
executed.
Hardware and Software
Instruction Cycle
• Set of operations to be followed to execute an
instruction.
• Fetch:
• Retrieving an instruction or data from memory.
• Decode:
• Interpreting the instruction
• Store:
• Write the results into memory
Hardware and Software
Bus Interface Unit (BIU)
• Provides functions for transferring data between
execution unit and other components that lie
outside CPU.
• Data Bus, Control Bus, Address Bus
Hardware and Software
Bus Interface Unit (BIU)
• Put the content of the program counter on
the address bus.
• Memory unit place the content/data on the
data bus and the memory address shared
by BIU.
• Transfer the IR of the processor through
MBR.
• Program Counter value is incremented so
that it stores the new address of the next
instruction.
Hardware and Software
Input and Output Devices
Hardware and Software
Input and Output Devices
Hardware and Software
Input and Output Devices
• I/P Device: Feed data and instructions into
computer
• Eg. Keyboard, Mouse, Trackball, JoyStick,
Stylus, Touch screen, barcode reader,
Optical Character Recognition(OCR),
Optical Mark Recognition (OMR), web
and digital camera.
Hardware and Software
Input and Output Devices
• O/P Device:
– Outputs/Gives information from the computer
– Types: Soft Copy & Hard Copy o/p devices
• Soft Copy O/P Device
– Produce and electronic version of an output.
– Displayed on the computer screen(monitor).
– Output can be viewed only when the computer
is switched on.
– User can edit the soft copy output.
– Cannot be used by people who cannot have a
computer
– Searching data is very easy and fast
– Electronic distribution of soft copy is cheaper.
Hardware and Software
Input and Output Devices
• Hard Copy O/P Device
– Produce physical form of output.
– Computer is not needed to see the output.
– Editing is very difficult.
– Can be easily distributed to people who
do not have a computer.
– Searching data is tiring and difficult job.
– Distribution of hard copy is difficult and
slower.
Hardware and Software
MEMORY DEVICES
• Internal storage area used to store data and
programs either permanently or temporarily.
• Types: Main Memory, Secondary Memory
• Main Memory
– Holds instruction and data when program
is executing.
• Secondary Memory
– Holds instruction and data not currently in
use and provides long term storage.
Hardware and Software
Memory Devices
Hardware and Software
MEMORY HIERARCHY
Hardware and Software
MEMORY HIERARCHY
• Memory at a higher level in the storage hierarchy has
less capacity to store, is expensive and fast to access .
CPU Register
• Located inside the processor
• Directly accessed by CPU (processor)
• Fastest access
Cache Memory
• Intermediary form of storage between registers and
main memory
• Keeping frequently accessed data and instructions to
avoids accessing the slower primary memory.
• Increase speed and performance.
• Cache Memory – Main Memory – Register – Cache
Memory
Hardware and Software
PRIMARY MEMORY
• Main Memory/Internal Memory can
be directly access by CPU.
• CPU reads and execute the
instructions stored at main memory.
• Types
–RAM
–ROM
Hardware and Software
RAM
• Volatile/Temporary Storage area within
the computer can be accessed by CPU.
• RAM is loaded from HDD i.e. Data, OS,
application related to execution.
• Any memory cell can be directly accessed,
if its address is known.
• System operates at low speed when RAM
is full.
• Search to identify the memory portion that
have not been utilized.
• Frees up to load the require data.
Hardware and Software
RAM
• Types
– Static RAM
– Dynamic RAM
Static RAM
– Holds data without an external reference as long as
it is powered.
– Made of D flip flops
– Memory cells flip flop between 0 and 1 without the
use of capacitor.
– Occupies more space and more expensive.
– Four to six transistors to store a bit.
– Faster and More Reliable
– Often used as Cache memory (L1,L2)
– Used in household appliances, car and handheld
electronic devices.
Hardware and Software
RAM
Dynamic RAM
– Used as a main memory.
– Conatains million of memory cells
– Each cell made up of transistor and capacitor
– Each cell can contain one bit of information (0 or 1)
– Tiny amount of power given to cell to charge the
capacitor.
– Transistor checks for the charge in the capacitor
while read the data. If yes -1 / No- 0
– Capacitor leaks the energy very quickly.
– To maintain the charge(information) at capacitor
refresh is needed frequently.
– Cheap, more data can be stored and less heat.
– Used in personal computers, work stations and
servers
Hardware and Software
RAM
Dynamic RAM
– Types
» Synchronous DRAM (SDRAM)
» Enhanced DRAM (ESDRAM)
» Double Data Rate RAM (DDR)
» Rambus DRAM (RDRAM)
» Synchronous link dynamic RAM
(SLDRAM)
Hardware and Software
RAM
Dynamic RAM
Synchronous DRAM (SDRAM)
– Synchronize itself with clock speed of microprocessor to
enable faster access to memory.
Enhanced SDRAM
– Small SDRAM cache to reduce the delays in data access
and speed up operations.
Double Data Rate RAM
– Data transfer in both raising and falling edges of the
clock cycle.
– Doubles the data throughput.
– DDR SDRAM – 128 MB to 1 GB
– DDR2 SDRAM – 256 MB to 2 GB (higher speed and low
latency)
Hardware and Software
RAM
Dynamic RAM
Rambus DRAM (RDRAM)
– Proprietary, protocol based and high speed memory
technology.
– Operate at extreme high frequencies.
Synchronous link DRAM
– Royalty free, open industry standard design alternative
to RDRAM.
Hardware and Software
ROM
• Read Only Memory
• Containing Permanent Data
• Non Volatile – Data will be there even in off state.
• Stores critical programs which are used to start or
turned on
• Update program at ROM – Removed and Physically
Replaced.
• Types
– PROM (Programmable ROM)
– EPROM(Erasable Programmable ROM)
– EEPROM(Electrically Erasable Programmable
ROM)
Hardware and Software
RAM vs ROM
Hardware and Software
ROM
PROM (Programmable ROM)
• One time programmable ROM
• Write once and read multiple times.
• Programming a PROM is called burning.
EPROM(Erasable Programmable ROM)
• Can be erased and reprogrammed.
• Strong ultra violet light can be used for
erase/write.
EEPROM(Electrically Erasable Programmable ROM)`
• Entire contents or selected contents Erased and re-
Written electrically.
• Writing EEPROM is called flashing.
Hardware and Software
SECONDARY STORAGE DEVICES
• Not directly accessed by CPU.
• Holds the data even after the power off.
• Non volatile and cheaper.
• Stores huge amount of data.
• Accessed by CPU in milliseconds.
• Formatted according to a file system - to
organize data into files and directories.
• File System: Describe owner, access time, access
permission etc.
• Eg. Magnetic Tape, Hard Disk, Compact
Disk(CD), USB flash drive, Memory Card and
blu ray disc.
Software
– Set of programs.
– Software is written by programmer using
programming language.
– Source code : Writing Set of instructions using
specific programming language.
– Compiler: Convert the source code to computer
understandable language format.
– Types
• System Software
• Application Software
Software
System Software
• To operate computer hardware and to provide and
maintain a platform for running application
software.
• Computer BIOS and Device Drivers
• Operating Systems
• Utility Software
• Translators
• Compilers
• Interpreter
• Assembler
• Linker
• Loader
• Debugger
Software
Computer BIOS and Device Drivers
• BIOS – Basic Input Output System
• Provide functionality to operate and control the
h/w connected to or built into a computer.
• First code run by computer when it is switched on.
• Load and start the OS.
• Initialize and identify system devices : video
display card, keyboard, mouse, hard disk,
CD/DVD and other hardware.
• Runs POST test – To ensure system devices are
working correctly.
• Booting:
• Locate , load and execute software from
peripheral devices such ah HDD or CD and
giving it control of the computer.
Software
Computer BIOS and Device Drivers
• BIOS is stored on ROM.
• Use the interface by pressing certain keys on the
keyboard when the PC starts.
Software
Computer BIOS and Device Drivers
Software
Operating Systems
Software
Operating Systems
– Group of computer programs that controls computer’s
resources such as CPU, Memory, I/O devices etc.
– Provides an interface that makes it easier to use.
– Goal : User to execute programs/software/ applications
Convenient and Efficiently.
– Functions of OS.
• Manages the computer resources.
• Provides a user interface
• Process Management
• Memory Management
• File Management
• Security Management
• Device Management
• Booting Services
Software
Operating Systems
Software
Utility Software
– Used to analyze, configure, optimize and
maintain the computer system.
– May be requested by application programs
during their execution of multiple purpose.
– Disk Defragmenters, Disk Checkers, Disk
Cleaners, Disk Space Analyzers, Disk
Partitions, Back up utilities, Disk Compression,
File managers, System Profilers, Anti virus
utilities, Data Compression utilities,
Cryptographic utilities, Launcher applications,
Registry Cleaners, Network utilities and
Command Line Interface.
Software
Translators
– Translate a code written in one programming
language to a code in another language that the
computer understands.
Software
Compilers
– Transforms the source code written in a PL into
machine language, which uses only 0s and 1s.
– i.e. High Level to Low Level (Assembly / Machine
Code)
– The resultant code in 0s and 1s is known as object code.
– Object code is used to create an executable program.
– If the source code contains error then the complier will
not be able to do its intended tasks.
– Compiler generates error message when it encounters
any type of error.
– Syntax Error: Type mistake, illegal character ,
undefined variables.
– Logical Error: Program does not function accurately –
Harder to locate and correct errors.
Software
Compilers
Software
Compilers
– Translate human readable source code into computer
executable machine code.
– Locate the syntax error but cannot fix it.
– Unless the syntactical error is rectified , the source code
cannot be converted into the object code.
– Each high level language has its own compiler.
– Eg. Java Compiler, g++ compiler.
Software
Interpreter
– Translate instructions into an intermediate form, which
it then executes.
– Takes one statement of high level code , translate into
machine level code , execute it and then takes the next
statement and repeats the process until the entire
program is translated.
Software
Compiler Vs Interpreter
Software
Assembler
– Convert the assembly language code into an equivalent
code in machine language(Object Code).
– If there is an error , assembler gives list of errors.
– Object code is created only when the Assembly level code is
free from errors.
– E.g. MASM, TASM,NASM,YASM,VASM Etc.
Software
Linker
– Modular Approach : Easy to code, edit, debug, test ,
document and maintain.
– After module compilation an object of that module is
generated.
– Once the modules coded and tested the object files of all the
modules are combined together to form a final executable
program.
– Linker as the last step in compilation process.
Software
Loader
– Special Program – Part of OS
– Copies the program from a storage device to the main
memory, which they can be executed.
Debugger:
Necessary Step in software development process
Software
Debugger:
– Necessary Step in software development process
– Identifying error(bugs) and removing at the
earliest.
– Debugger : Identify the error at different stages
of software development.
– When system crashes , the debugger show the
position of the error in the program.
– Allow programmers to run code in a step by step
mode
Software
Debugger:
– Helps the programmer in the following ways
Software
Application Software:
– Designed for user to solve a particular problem
or
– Employs the capabilities of a computer directly to
perform a user defined task.
– E.g. Word Processors, Spread Sheets, Media
Players, Education Software, CAD,CAM, Data
Communication Software, Statistical and
Operational Research Software Etc.
– Word Processing: Microsoft Word
– Spread Sheet Program: Microsoft Excel
– Presentation Software: Microsoft Powerpoint
– Database Software: Microsoft Access
Software
Application Software:
– Graphics Software : Image Editing
– Animation Software :
• Simulates a movement and display a sequence
of images in a period of time.
– CAD Software
• Architectural drawings, product designs,
landscaping plans and engineering drawings.
– Multimedia Software
• Combination of text, audio, still images,
animation, video and interactivity contents.
• Advertisement, Edutainment Etc.
Problem Solving Strategies
• Programmer to clearly understand the problem
and instruct a computer correctly and precisely.
Steps:
– Define Problem : Clear, Very Simple and Precise
Language.
– Analyze Problem: Find out different ways to
solve the problem.
– Evaluate: Evaluate all options and decide the best
solution.
– Define the selected solution in a detailed step by
step manner.
– Write the steps in particular programming
language.
– Execute by Computer.
Problem Solving Strategies
Phases in SDLC (Software Development Life Cycle)
Problem Solving Strategies
Phases in SDLC (Software Development Life Cycle)
1. Requirement Analysis
– User’s expectations are gathered to know
why the program/software has to be built.
– Requirements are analyzed and arrive the
scope and objective of the product.
– To avoid doubts and uncertainty all
requirements / functionalities are
documented.
– Functionality, Capability, Performance
and Availability of hardware/software are
analyzed.
Problem Solving Strategies
Phases in SDLC (Software Development Life Cycle)
2. Design
– Input : Requirement Analyze Phase
– Specifies how the program/software will be
built.
– Plan of action is made and followed
throughout the development process.
– Core structure/program is broken into
modules.
– Each module is specified in the form of
algorithm or flowchart.
Problem Solving Strategies
Phases in SDLC (Software Development Life Cycle)
3. Implementation
– Construction or code generation phase.
– Designed algorithms are converted into
program code.
– Language selection depends on
application(system s/w or application s/w)
– Codes are tested by programmer to ensure the
correctness.
– Development team checks the software
compatibility with the available hardware and
other software mentioned on Requirement
Specification Document.
Problem Solving Strategies
Phases in SDLC (Software Development Life Cycle)
4. Testing
– Possibility for bugs after the integration of all
modules.
– All modules are tested together to ensure that the
overall system work well as a whole product.
– Tested by using a large number of varied
inputs(data) to ensure software working as
expected as user’s requirements.
Problem Solving Strategies
Phases in SDLC (Software Development Life Cycle)
5. Software Deployment, Training and Support
– After the approval by users , its installed or
deployed into production environment.
– Given more training to users of the software for
how to use and fix certain problems.
6. Maintenance
– Maintenance and enhancements are ongoing
activities that are done to cope with newly
discovered problems or new requirements.
– Extra Piece of code / Addition of code required to
fix an unforeseen problem.
– If the software quality is poor better to go for re-
build the software.
Program Design Tools
– Algorithms
– Flowcharts
– Pseudo odes
Program Design Tools
Algorithm
– Gives the logic of the program : Step by step
description of how to arrive at a solution.
or
– Procedure for solving a problem in a finite
number of steps.
– Provides a blue print to writing a program to
solve a particular problem.
– Mainly used to achieve software reuse.
Program Design Tools
Algorithm - Characteristics
– Be Precise
– Be Unambiguous
– Not even a single instruction must be repeated
infinitely.
– After the algorithm gets terminated, the desired
results must be obtained.
Program Design Tools
Designing an Algorithm
Modularization
– Complex Program – Algorithm divided into
smaller units called modules.
– Process of dividing an algorithm into module is
called modularization.
Advantages of Modularization
– Makes complex algorithm simpler into design
and implement.
– Each module can be designed independently.
– Enhancing clarity in design : simplifies the
implementation, debugging, testing, documenting
and maintenance of the overall algorithm.
Program Design Tools
Designing an Algorithm
– Top Down Approach
– Bottom Up Approach
Program Design Tools
Designing an Algorithm
– Top Down Approach
Dividing the complex algorithm into one or
more modules – one or more sub modules.
Begin with topmost module and
incrementally add modules that it calls.
Start from an abstract design and then at
each step , the design is refined into more
concrete levels until a level is reached that
requires no further refinement.
Program Design Tools
Designing an Algorithm
– Bottom Up Approach
Reverse of Top Down Approach.
Start with the most basic or concrete modules
and then proceed towards designing higher
level modules.
Sub modules are grouped together to form a
higher level module or above that module.
Higher modules are implemented by using the
operations performed by the lower level
modules.
Process is repeated until the design of the
complete algorithm is obtained.
Program Design Tools
Control Structure in Algorithm
1. Sequence
– Each step of the algorithm is executed in the
specified order.
2. Decision
– Outcome of the process depended on some
condition.
– If the condition is true then process 1 executed
else process 2 executed.
Program Design Tools
Control Structure in Algorithm
3. Repetition
– Executing one or more steps for a
number of times.
– Implemented using while or do-while
or for loops.
– Loops will execute until some
condition is true.
Program Design Tools
Control Structure in Algorithm
Recursion
– Solving problem by breaking it
down into smaller and smaller sub
problems until you get into a small
enough problem that it can be easily
solved.
– Function calling itself until a
specified condition is met.
Program Design Tools
Flowchart
• Graphical or Symbolic representation of
process.
• Design and document complex processes
• Visualize the logic of the process
– Better understanding of the process and find
flaws, bottlenecks and other less obvious
features within it.
Program Design Tools
Flowchart : Symbols
– Start and End Symbols: Circles, Ovals or
Rounded Rectangles.
– Control of the program :Arrows
– Generic Processing Step(Execution of instruction):
Rectangle
– Input/output Symbols: Parallelogram
– Condition or Decision Symbol: Diamond
– Labeled Connectors: Circle
Program Design Tools
Significance of Flowchart :
– Illustrates the sequence of steps that must be
performed to solve a problem.
– Facilitates the communication between
programmers and users.
– Programmers can make users to understand the
solution easily and clearly.
– Help the programmers to understand the logic of
complicated and lengthy problems.
– Easy to write programs in any high level
language.
Program Design Tools
Advantages of Flowchart :
– Good Communication Tool for explain the logic
of the system to all concerned.
– Helps to analyze the problem in more effective
manner.
– Used for program documentation for
simple/complex problems.
– Acts as a blue print or guide for the
programmers to code in any programming
language.
– Makes error free program.
– Easy to debug : detect, locate and remove
mistakes in a systematic manner.
Program Design Tools
Limitations of Flowchart :
– Drawing flowchart is laborious and time
consuming activity.
– Complex programs becomes complex and
clumsy.
– Little bit of alteration in solution may require
complete redrawing of the flowchart.
– What is done may get lost in the technical details
of how its is done.
– No well defined standards
– Requires more space on paper.
Program Design Tools
Pseudocode:
– Compact and informal high level description of
an algorithm that uses structural conventions of a
programming language.
– Facilitate the designer to focus more on logic of
the program.
– It must be complete describing the entire logic of
the program.
– It can be translated straightaway into a
programming language.
– It includes variable declaration, system specific
codes and sub routines.
– Supports easy conversion of programming
language.
Program Design Tools
Pseudocode:
– Should not include keywords of any specific
computer language.
– Helps to enhance human understandbility of the
solution.
– Helps non programmer to understand the logic of
the designed solution.
– No standards defined for writing pseudocode.