0% found this document useful (0 votes)
2 views45 pages

lect02

The document provides an overview of computer systems, including definitions of hardware, software, and their components such as CPU, RAM, and storage devices. It explains the architecture of computers, the functioning of CPUs, types of memory, and the execution of instructions. Additionally, it covers programming languages, software development processes, and debugging techniques.

Uploaded by

ramez
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views45 pages

lect02

The document provides an overview of computer systems, including definitions of hardware, software, and their components such as CPU, RAM, and storage devices. It explains the architecture of computers, the functioning of CPUs, types of memory, and the execution of instructions. Additionally, it covers programming languages, software development processes, and debugging techniques.

Uploaded by

ramez
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Computer?

 a programmable machine that


 Receives input
 Stores and manipulates data
 Provides output in a useful format
Computer Hardware

All the physical components of computer are


called Computer Hardware
OR
All the touchable parts of computer are called
Computer Hardware

For example: keyboard, mouse, hard disk,


RAM, ROM, CPU
Computer Architecture

Basic architecture of computer


means how computer hardwar
e works, how hardware compo
nents of computer system conn
ect to each other.
Computer Architecture
DATA BUS

CPU
H.D Key
Board Prin
Cache ter
CU

Math
ROM RAM
coprocessor
ALU
Mouse
F.D

Clock

Monitor

ADDRESS & CONTROL BUS


Computer Architecture
System Unit
Computer Architecture
System Unit

System may be defined as a set of related compon


ents. So, System unit may be defined as follows:

A system unit is the part of a computer that hou


ses the primary devices that perform operations
and produce results for complex calculations. It
includes the motherboard, CPU, RAM and other com
ponents, as well as the case in which these devi
ces are housed.
Computer Architecture
Motherboard / Mainboard
It is the main circuit board in computer sys
tem. It contains all the circuits and connect
ors. All devices attached with the computer
are basically attached with the motherboar
d through connectors.
Computer Architecture
CPU (Central Processing Unit)
•CPU is the central part of the computer sys
tem. It is also called brain of computer syst
em. As in human body, the brain takes all
major decisions and other parts of the bod
y perform different functions as directed b
y brain.
Computer Architecture
CPU
Control Unit (CU)
Control unit controls overall operations of
computer. The CU fetches instructions from
main memory (RAM), interprets them, fetc
hes required data and tell ALU what to do.
Arithmetic Logic Unit (ALU)
This unit handles the arithmetic and logic
functions with in the CPU. It takes instructi
ons decoded by the Control Unit, and perfo
rms actions as directed by control unit.
Computer Architecture
Performance of CPU
Performance of CPU can be measured by following
factors:
Register Size
A CPU with large register size can store large amou
nt of data. Hence greater the register size there wil
l be better performance of CPU.
Instruction Set Size
A CPU can execute only a limited number of instruc
tions for all types of operations. That set of instruc
tions is called instruction. The greater the instructi
on set size there will be better performance of CPU
.
Computer Architecture
Performance of CPU
Clock Speed
The CPU clock can generate from 100 to 10
00 million ticks in a second. The number of
ticks generated in a second by a CPU is call
ed the frequency of that CPU. The unit to
measure the frequency is Hertz.
Computer Architecture
How CPU executes an instruction ?
Following four steps are involved in the execut
ion of an instruction:
Instruction Fetch: First of all, the instruction, t
o be executed is fetched in CPU from RAM (mai
n memory). CU performs this function.
Interpret Instruction:
In this stage, CPU interpret/decode instruction
. CPU decides what action is to be taken for th
e execution of the instruction. CU performs thi
s function.
Computer Architecture
How CPU executes an instruction ?
Data Fetch: If some data is required for the ex
ecution of the instruction, that data will be fet
ched from the memory (where it resides) and l
oaded into CPU register. CU performs this oper
ation of fetching data from memory and loads i
t in CPU register.
Execute Instruction:
When an instruction has been decoded, and re
quired data is fetched, then the CPU actually e
xecutes the instruction. Normally, ALU execute
s most of the instructions.
Computer Architecture
RAM(Random Access Memory)
Computer Architecture
RAM

RAM stands for Random Access Memory because i


t is possible to randomly select and use any locati
on of this memory to directly store and retrieve dat
a and instruction.
Why RAM is called Main Memory?

RAM is also called main memory or primary memor


y because CPU directly communicates with RAM. Al
l the data or instructions that we enter into a comp
uter directly goes to RAM and after executing the i
nstructions final results goes to RAM from where r
esults are gone to out put device.
Computer Architecture

Temporary/Volatile nature:
As soon as the computer is switched off al
l the data stored in RAM is washed out. Tha
t’s why RAM is also called volatile memory
or temporary memory.
Computer Architecture

Types of RAM
DRAM
DRAM stands for Dynamic RAM. It is a popular
type of RAM and is mostly used in computer. D
RAM is refreshed many times in a second that’
s why it is relatively slower than SRAM. Howev
er it is cheaper, easily available and requires le
ss power.
Computer Architecture

SRAM
SRAM stands for Static RAM. SRAM is not so po
pular because it is expensive and requires mor
e space and power than DRAM. SRAM is faster
than DRAM because it does not have to refresh
many times in a second.
Example:
Cache Memory
Computer Architecture
ROM(Read Only Memory)
ROM stands for Read Only Memory. It is t
he type of memory where those programs
and data are kept which needs no change.
The data once stored here can’t be change
d or modified. It is also not possible to writ
e new information into ROM. This is the rea
son why it is called Read Only Memory.
Computer Architecture
Types of ROM
PROM
PROM stands for Programmable Read Only Me
mory. Computer system manufacturer provide
s ROM chips and it is not possible for a custom
er to modify the programs stored insides the R
OM chip.
EPROM
EPROM stands for Erasable Programmable Rea
d Only Memory. As the name implies, it is possi
ble to erase information stored in an EPROM c
hip and the chip can be reprogrammed to store
new information using a special prom-program
mer facility.
Computer Architecture
Types of ROM
EEPROM
EEPROM stands for Electrically Erasable Pr
ogrammable Read Only Memory. This type
of ROM chip can be used several times by u
sing special electrical devices.
Uses
R&D personnel mainly use EPROM because
they frequently change the micro programs
to test the efficiency of the computer syste
m with new programs.
Computer Architecture

Hard Disk Drive


It is a popular secondary storage medium
uses now a days that no PC is assembled w
ithout it. It exists in almost every compute
r system that is used. It is also called fixed
disk.
Computer Architecture

Floppy Disk

Floppy disk is also called simply a diskette or


disk. It is a small flexible plastic disk that is co
ated with magnetic material. It was invented b
y IBM in early 1960s.
Uses:
Now a days usually floppy disks are used to tr
ansfer small amount of data from one compute
r to another computer.
Computer Architecture
Keyboard

Keyboard is the most widely used input device. It


is used to enter data and program instructions into
the computer.
Mouse

Mouse is also an important input device. It is use


d for controlling screen cursor.
Computer Architecture

Monitor

The monitor or Visual Display Unit (VDU) i


s the most commonly used output device. I
t is like a TV screen. It can display alphanu
meric characters, special characters and gr
aphics.
The output provided by monitor is called ‘
soft copy’.
Computer System
 Computer System
 Hardware + Software

 Computer Hardware

Hard Disk Drive (HDD) DVD/CD

Main Memory

CPU Monitor
Keyboard

26
Computer Hardware
 CPU (Central Processing Unit)
 Processing program instructions (one by one)
 Basic program instructions : add/subtract/multiply/div, read/write, jump, test
 Cache : duplicating original data stored in slow storage into faster storage

 Main Memory (e.g. RAM)


 Volatile : when power turned off, data in the memory will be erased
 Storing progam and data
 Fast, small, and expensive

 Secondary Memory (e.g. HDD, CD/DVD, …)


 Non volatile
 Relatively slow, large, and cheap

 I/O(Input/Output) Device
 Help interaction between computer and human beings.
 Keyboard, mouse, monitor, etc
27
Memory and Data

1278
10011010 Each memory cell stores
1279
1 byte data
1280
1281
1282 Bigger data values are
Stored in consecutive memory cells
1283
1284
1285
1286

28
Memory Units
 1 bit
 1 Byte = 8 bits
 1 KB = 2^10 Byte = 1,024
 1 MB = 2^20 Byte = 1,048,576
 1 GB = 2^30 Byte = 1,073,741,824
 1 TB = 2^40 Byte = 1,099,511,627,776
Program Execution
 von Neumann architecture

Main Memory
loading
Program Program
(Instruction + Data)

Instruction result Instruction, data fetch

CPU PC

30
Software
 system software
 Efficient management of computer system and resources
 Operating System, compiler, debugger

 application software
 All kinds of software other than system software
 Wordprocessor, spreadsheet(excel), graphics SW, artificial
intelligence SW, Game SW, Statistics SW, medical SW

31
Software Layers

Application S/W

Powerpoint System S/W


Wordprocessor
OS
Utilities Debugger

Compiler
Web Browser Database

32
Data Representation
 Binary number 1 bit 2 bit 3 bit 4 bit
 Computer uses binary 0 00 000 0000
number 1 01 001 0001
10 010 0010
 1bit can represent 0 or 1 11 011 0011
 N bit number can 100 0100
represent up to 2N 101 0101
110 0110
111 0111
1000
1001
1010
1011
1100
1101
1110
1111

33
Binary number, decimal number
 Decimal number
 Use 0 - 9
 182 = 1 x 102 + 8 x 101 + 2 x 100
= 1 x 100 + 8 x 10 + 2 x 1

 Binary number
 Use 0 and 1
 11012 = 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20
=1x8+ 1x4 + 0x2 +1x1
= 13

 Octal number
 Hexadecimal number
34
Programming Language
 Language for programming computer processing
 Machine readable language designed to express computations that can be
performed by a computer
 Specify behavior of machine, express algorithms
 Human-Computer Communications

 Machine language
 Binary code
1001 0001 store value at address 0001 into accumulator
1100 0010 add value at address 0010 into accumulator

 Assembly Language
 Symbolization of machine language binary code
LOAD Y
ADD Z

35
Programming Language
 High level language
 Easy to use (read and write) , human friendly
 Programmer does not need to know details of machine control.
 More portable (machine independent)

X=Y+Z

 example
 FORTRAN, COBOL, BASIC, C, C++, Java

36
High Level Programming Language
 FORTRAN(FORmula TRANslation)
 Created in 1957 by John Backus (IBM)
 General purpose PL especially suited For scientific computation

 COBOL(COmmon Business Oriented Language)


 Created in early 1960s
 Primarily used for business, finance in companies and govenment

 BASIC(Beginner's All-purpose Symbolic Instruction Code)


 Easy to learn and use for beginners

37
High Level Programming Language
 C
 Made by Dennis Ritchie (AT&T Bell Lab)
 made for developing UNIX OS (1970s)
 High level language with low level language properties (pointers,…)

 C++
 Made by B. Stroustrup (AT&T Bell Lab)
 OOPL(Object Oriented Programming Language) extending C

 Java
 Made by James Gosling (Sun Microsystems, 1990s)
 Platform independent OOPL

38
Software Development Process
 Requirement analysis
 Design
 Implementation
 Testing
 Maintenance
Programming and Execution
 Programming Tool
 Editor, Compiler, Interpreter, Debugger, and etc
 Integrated Development Environment (IDE)

Program Edit

Error
Error
Compile

Execution

40
Error
 compile-time error
 Error occurring during compilation
 Grammar check
 Cannot execute if there is compile error

 logical error
 Grammar is OK but logical error

 run-time error
 Abnormal termination owing to unexpected reasons during program
execution
 Ex) divided by zero, illegal memory access

41
Debugging
 debugging
 Bug : program error
 Debugging : bug correction

42
Compiler / Interpreter
 Compiler
 Convert high level language to low level language
(occur at compile-time)

 Interpreter
 Compile and execute the program line by line
(occur at run-time)

 Comparison?

43
Practice
Conversion
Binary number -> decimal number
(1) 0101 →
(2) 1001 →
(3) 010101 →

Decimal number -> binary number


(1) 17 →
(2) 85 →
(3) 120 →
Difference between
high-level languages and low-level languages

You might also like