Beruflich Dokumente
Kultur Dokumente
Foundation Concepts
o The mind is not a vessel to be filled, but a fire to
be kindled.
– Plutarch
What is Computer Science
o A scientific and engineering discipline that
investigates all aspects of computing with
computing machines.
o Computing is about
– problem solving, and
– applying computing technologies to improve human
existence
Comparison between CS and Natural
Sciences
Natural Sciences Computer Science
Investigates natural world Investigates artificial, human-
created world.
Deals with laws of nature Also deals with human
assumptions, biases
CS & Mathematics
o CS shares much with mathematics because:
– Mathematics also studies a world of logic (logic of
numbers).
CS & Engineering
o The root of CS lie both in Mathematics and
electronics engineering
Software
Engineering
CS & Engineering
– CS growing from mathematics focusing on theoretical
concepts and software
– Computer Engineering diverging from electronics
engineering, emphasizing the design and fabrication
of computers.
Software
Engineering
CS & Engineering
– Software Engineering:
• Another discipline emerging from CS to build software with
the certainty and predictability of the traditional
engineering disciplines.
Software
Engineering
SOME INTERDISCIPLINARY FIELDS
Some Interdisciplinary Fields
o Information Systems
o Geographical Information Systems
o Bioinformatics
o Biomedical Systems
o Information Technology
o Information Security and Assurance
Information Systems
o The application of Computing Technology to
organizations and businesses
Geographical Information Systems
o The application of computing technology for
representing geographical information, used
heavily by cities governmental organization
Bioinformatics
o The application of computing technology in
biological systems; one area is representing genes
and DNA
Biomedical Systems
o The application of computing technology in
medical domains and patients care and histories,
for use by medical practitioners
Information Technology
o The study of the management and maintenance
of computing systems, including networking,
operating systems, hardware and software
Information Security and Assurance
Computer
Engineering
Software
Physics Engineering
Management
Information
Computer Applied
Information Systems Business
Science Computer
Systems Admin.
Science
Math Information
Information Security &
Technology Assurance
Applied Technology
Artisan
EVOLUTION OF THE COMPUTER
Evolution of the Computer
o First Generation
o Second Generation
o Third Generation
o Fourth Generation
o Fifth Generation
First Generation of Modern Computers
Date Scientist Country Name Programmable Binary Electronic
May 1941 Conrad Zuse Germany Z3 Punched film Yes No
Summer John Germany/ ABC No Yes Yes
1941 Atanasoff USA
1943 Tommy UK Colossus By rewiring Yes Yes
Flowers
1944 Howard USA Harvard Punched paper No Yes
Aiken/IBM Mark I tape
1944 Mauchly & USA ENIAC By rewiring No Yes
Eckert
Zuse Z3 in Deutschen Museum in
München
Atanasoff–Berry Computer replica at
1st floor of Durham Center, Iowa State
University
Colossus
Harvard Mark I
ENIAC
(Electronic Numerical Integrator And Computer)
Second-Generation Computers
o 1958-1964
o Transistor (1947) replaced vacuum tubes
– Smaller and less power hungry: larger computers
could be built
o Stored-program + Machine Language replaced
hard wiring
Vacuum Tube & Transistor
Third Generation Computers
o 1965-1971
o Integrated Chips
– (Many transistors on the integrated on the same chip)
– Lower Power requirement
– Faster Computers
o Software
– Development of high level programming language
– Easier to program computers
o Machines of this era started making inroads to the
business enterprises
o Millions of operations per second
Fourth Generation Computers
o 1971-1995
o Very Large Scale Integrated (VLSI) Chips
o Microprocessor
– Lower Cost
– Introduction of Personal Computers
o Software
– Application software, Word processors, gaming etc.
– AI
o Embedded Systems and Robots
o Hundred million of operations per second or more
Fifth Generation Computers
o 1995 –
o Parallel, Grid / Distributed Computing
o Mobile Computing
o Internet/World Wide Web
o Software
– Distributed Object Technologies
– Middleware
• Applications are constructed in layers or tiers
• Maybe distributed along network
Five Generations of Computer
Generation Key Hardware Key Software Examples
First Vacuum tubes Machine/Assemble ENIAC, IBM 701
Language
Second Transistors Batch OS, High level Honeywell 400,
languages IBM 7030
Third Integrated Time Sharing OS IBM 360/370, PDP-
Chips (ICs) 8
Fourth Microprocessor OS for PCs, GUI, IBM PC, Apple
Macintosh
Fifth Multicore WWW, multimedia Sun Workstations,
Processor applications Portable
Computers,
Supercomputer
Future Trends
o Grid Computing Systems
o Enhancement in Persoanl/Mobile computing
power
o Quantum Computing
– Using sub-atomic particles to store and manipulate
data
Computing Fundamentals
Input
Arithmetic
Unit
Logic Unit
Memory
Control Output
Unit Unit
CA-Ch02 2-4
Input Unit
o Accepts instructions and data from outside world
o Converts these instructions and data in computer
acceptable form.
– Units called input interfaces accomplish this task
o Supplies the converted instruction and data to
the CPU for further processing and/or storage.
Output Unit
o Accepts the produced results.
o Converts these produced results to human
acceptable form.
– Units called output interfaces accomplish this task
o Supplies the converted results to the outside
world.
Storage Unit
o Stores
– The data and instructions required for processing
– Intermediate results of processing
– Final result of processing, before the system releases
to the output unit.
Arithmetic Logic Unit
o Performs
– Arithmetic operations &
– Logic operations
Number Systems
Join the Group
o computing_fundamentals-subscribe@yahoogroups.com
Decimal
Binary
Octal
Hexadecimal
Decimal
5
Binary
6
Binary
o Binary TO Decimal Conversion
7
Binary
o Decimal TO Binary Conversion
8
Octal
o Octal to Decimal Conversion
o Decimal to Octal Conversion
o Octal to Binary Conversion
o Binary to Octal Conversion
9
Hexadecimal
o Hex to Decimal Conversion
o Decimal to Hex Conversion
o Hex to Binary Conversion
o Binary to Hex Conversion
10
FRACTIONS
11
Conversion of Decimal fraction to
Binary
Example:
Integer Fraction
0.6875 x 2 = 1.3750 = 1 + 0.3750
x 2 = 0.7500 = 0 + 0.7500
x 2 = 1. 5000 = 1 + 0.5000
x 2 = 1. 0000 = 1 + 0.0000
0.6875 = (0.1 0 1 1) 2
13
Conversion of Decimal fraction to
Binary (cont.)
o To convert a full Decimal Number to Binary, Convert the
integer and Fraction Part Separately:
o Example
Convert 3.6875 to Binary
Step-1
• Convert Integer Part to Binary:
• 3 = (11)2
Step-2
• Convert Fraction Part to Binary:
• 0.6875 = (0.1011)2
Step-3
• Combine them:
• 3.6875 = (11.1011)2
14
Conversion of Binary Fraction to
Decimal fraction
Example:
(0 .1 0 1 1) 2 = __1 + __
0 + __ 1 + __1
( 2)1 (2 )2 ( 2)3 ( 2)4
15
Conversion of Binary fraction to
Decimal (cont.)
o To convert a full Binary Number to Decimal, Convert the
integer and Fraction Part Separately:
o Example
Convert (11.1011)2 to Decimal
Step-1
• Convert Integer Part to Decimal:
• (11)2 = 3
Step-2
• Convert Fraction Part to Decimal:
• (0.1011)2 = 0.6875
Step-3
• Combine them:
• (11.1011)2 = 3.6875
16
Homework
o Conversion of HEX fractions into Decimal and vice
versa
17
COMPLEMENTS
18
Complements
o Used to simplify subtraction operation in digital
computers
o Simplifying operation simple circuit
o Two Types
Radix Complement (r’s complement)
Diminished Radix Complement ((r- ’s o ple e t
Where r = base of the number M
19
Diminished Radix Complement
o Given a number N in base r having n digits, the
diminished radix complement of the number N is
o (rn-1) – N
o For decimal numbers, r=10
o (r- ’s o ple e t = 9’s o ple e t
o Example:
9’s o ple e t of N =
= 999999-546700 = 453299
20
Diminished Radix Complement (cont)
21
Radix Complement
o Given a number N in base r having n digits, the
diminished radix complement of the number N is
o rn – N for N≠0
o For decimal numbers, r=10
o r’s o ple e t = ’s o ple e t
o Example:
’s o ple e t of N =
= 1000000-546700 = 453300
22
Radix Complement (cont)
o For binary numbers, r=2
o r’s o ple e t = ’s o ple e t
o Example:
’s o ple e t of N =
= 10000000-1011000 = 0101000
23
’s Co ple e t of Bi ary Nu ers
1 1 1 0 1 0 0
0 0 0 1 0 1 1
24
’s Co ple e t of Bi ary Nu ers
0 0 0 1 0 1 1 ’s o ple e t
1 Add 1
0 0 0 1 1 0 0 ’s o ple e t
25
Subtraction with r’s complemnt
o Example
o X = (0101 0100)2
o Y = (0100 0011)2
o X- Y = ?
X= 0101 0100
2'S complement of Y= 1011 1101
Sum = 1 0001 0001
Discard end carry 28= -1 0000 0000
Answer 0001 0001
26
Computing Fundamentals
Computer Codes
Codes
o Codes are standards to represent characters in
computers.
Major Advantages of using Codes
o E a le eas tra sfer a d e ha ge of data…
between computers,
between computers and peripheral devices
o 8-bit code
2-bits more added to zone bits
o ANSI
American National Standard Institute
ASCII-7 vs ASCII-8
o ASCII-7
7-BIT CODE
Can represent 27 = 128 different characters
o ASCII-8
8-BIT CODE
Can represent 28 = 256 different characters
Homework
o Write the ASCII codes for the following:
A
a
0
9
space
o Write the ASCII codes for following words
PAKISTAN
COMPUTER
UNICODE
UNICODE
o Provides a unique number for every character for all
platforms and all languages.
Computer Arithmetic
Why Binary?
o Components of a Digital computer can indicate
only two states i.e.
Conducting State (TRUE) or
Non-Conducting State (FALSE)
o Binary Numbers are thus most suitable to
represent these two states.
Binary Arithmetic
o Binary Addition
o Binary Subtraction
o Binary Multiplication
o Binary Division
BINARY ADDITION
Binary Addition
o0+0=0
o0+1=1
o1+0=1
o 1 + 1 = 0 plus carry of 1 to next higher binary digit
BINARY SUBTRACTION
Binary Subtraction
o0-0=0
o 0 - 1 = 1 with a borrow from next higher digit
o1-0=1
o1-1=0
Binary Subtraction
o Complimentary Subtraction
Subtraction with r’s complemnt
o Example
o X = (1010100)2
o Y = (1000011)2
o X- Y = ?
X= 101 0100
2'S complement of Y= 011 1101
Sum = 1 001 0001
Discard end carry = 0010001
10
Subtraction with r’s complemnt
o Example
o X = (1010100)2
o Y = (1000011)2
o Y-X = ?
Y= 100 0011
2'S complement of X= +010 1100
Sum = 110 1111
Si ce No Carry, Taki g 2 s Co ple e t with – sign= -001 0001
11
BINARY MULTIPLICATION
Binary Multiplication
o0x0=0
o0x1=0
o1x0=0
o1x1=1
Binary Multiplication
o 1010 x 1001
Additive Method of Binary
Multiplication
o 4x8
o=8+8+8+8
BINARY DIVISION
Binary Division
o 0 ÷ 0 = Divide by zero error
o0÷1=0
o 1 ÷ 0 = Divide by zero error
o1÷1=1
Binary Division
o 1011010 ÷ 1001
Additive Method of Binary Division
o 35 ÷ 5
1. 35 + (-5) = 30
2. 30 + (-5) = 25
3. 25 + (-5) = 20
4. 20 + (-5) = 15
5. 15 + (-5) = 10
6. 10 + (-5) =5
7. 5 + (-5) =0
Input(s) Output(s)
A B C
0 0 0
0 1 1
1 0 1
1 1 1
Basic Operations
o Logical Addition (OR operator)
Symbol: +
Truth Table for A + B = C
Input(s) Output(s)
A B C
0 0 0
0 1 1
1 0 1
1 1 1
Basic Operations
o Logical Multiplication (AND operator)
Symbol: .
Truth Table for A . B = C
Input(s) Output(s)
A B C
0 0 0
0 1 0
1 0 0
1 1 1
Basic Operations
o Complementation (NOT operator)
A unary operator i.e. works on only one variable
Symbol: - or
Truth Table for Ᾱ or A
Input(s) Output(s)
A Ᾱ
0 1
1 0
Operator Precedence
1. Expression is scanned from Left to Right
2. Parentheses
3. NOT
4. AND
5. OR
BOOLEAN PROPERTIES, LAWS
POSTULATES
Basic Theorems & Properties of
Boolean Algebra
o Postulate
x+0 = x
x.1 = x
o Postulate (Commutative Law)
x+y =y+x
x.y=y.x
o Postulate (Associative Law)
x + (y + z) = (x + y) +z
x (y.z) = (x.y) z
o Postulate (Distributive Law)
x . (y + z) = x . y + x . z
x + (y . z) = (x + y). (x + z)
o Postulate
+ =
. =
The Principle of Duality
o There is a duality between
Operators: . (AND) and + (OR),
Digits: 0 and 1
The Principle of Duality
1 + 1 = 1
0 . 0 = 0
1 + 0 = 0 + 1 = 1
0 . 1 = 1 . 0 = 0
The Principle of Duality
o There is a duality between
Operators: . (AND) and + (OR),
Digits: 0 and 1
X Y Z W
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
o Binary logic should NOT be confused with Binary
Arithmetic
1+1=1 1+1=10
22
LOGIC GATES
Logic Gates
o Electronic Circuits that operate on one or more
input signals to produce an output signal
24
Logic Gates
o Basic Logic Gates
AND
OR
NOT
Logic Gates
Logic Gate Boolean Operations
OR gate Logical Addition
AND gate Logical Multiplication
NOT gate Complementation
OR Gate
o OR operator
Input(s) Output(s)
A B C
0 0 0
0 1 1
1 0 1
1 1 1
AND Gate
o AND Gate
Input(s) Output(s)
A B C
0 0 0
0 1 0
1 0 0
1 1 1
NOT Gate
o NOT gate
Truth Table for Ᾱ or A
Input(s) Output(s)
A Ᾱ
0 1
1 0
NOR and NAND gates
o NOR Gate
Input(s) Output(s)
A B C
0 0 1
0 1 0
1 0 0
1 1 0
NOR and NAND gates
o NAND Gate
Input(s) Output(s)
A B C
0 0 1
0 1 1
1 0 1
1 1 0
LOGIC CIRCUITS
Logic Circuits
o Finding Boolean Expression from Logic Circuit
x = D2 + D3
y= D 3 + D 1 D 2’
V= D0 + D 1 + D2 + D3
Logic Circuits
o Converting Expression to Logic Gates
C = xy + xz + yz S= z+ z + z + z
HALF AND FULL ADDER
Half Adder
o A combinational circuit that performs the
addition of two bits is called a half adder.
x y C S
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
x
y'
S
x' xy’ + x'y
y
x
C
y xy
Half Adder x
S
y
Half Adder
Full Adder
o A combinational circuit that performs the
addition of three bits is called a FULL adder.
x y z C S
o S= z+ z + z + z
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
o C = xy + xz + yz
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
x'
y'
z
x
x' y
y
z'
S x
C
x z
y'
z'
y
x z
y
z Full Adder
Full Adder Carry
Sum
Computing Fundamentals
Input
Arithmetic
Unit
Logic Unit
Memory
Control Output
Unit Unit
CA-Ch02 2-2
MAIN MEMORY
Main Memory Organization
o Consists of several small
storage areas called
0
locations or cells. 1
o Each location can store 2
3
a fix number of bits
called word length of
the memory.
N-2
N-1
o Memory address
o Memory contents
Main Memory Capacity
o Number of bytes that can be stored in its main
memory
o KB
o MB
o GB
o TB
Types of Memory Chips
o RAM (Random Access Memory)
o ROM (Read Only Memory)
o PROM (Programmable Read Only Memory)
o EPROM (Erasable PROM)
o Cache
CENTRAL PROCESSING UNIT
Central Processing Unit
o Brain of computer
o Performs all major calculations and comparisons
o Controls the operations of other units
Central Processing Unit
o CU
o ALU
o Instruction Set
o Registers
o Processor Speed
Control Unit (CU)
o Selects and interprets program instructions and then
coordinates their execution
o Registers
o Decoder
o Microcode
I/O Register
o Backward compatibility
REGISTERS
Registers
o Special memory units
o Used for intermediate data transfers and
temporary storage of instruction and information
Fetch Decode
Execute
Execution of Instruction
Instruction
Read
Instruction Instruction
Execution interpretation
PROCESSOR SPEED
Processor Speed
o Clock Cycle
A series of electronic pulses for synchronization of
digital computers
o MIPS
Millions of Instructions Per Second
o BIPS
Billions of Instructions Per Second
Processor Speed
o Normally used to measure performance of
supercomputers
o MFLOPS (mega-flops)
Millions of Floating-point Operations Per Second
o GFLOPS (giga-flops)
Billions of Floating-point Operations Per Second
o TFLOPS (tera-flops)
Trillions of Floating-point Operations Per Second
o Floating Point Operations deal with very small
and very large numbers that require very high
precision data processing.
Computing Fundamentals
Input
Arithmetic
Unit
Logic Unit
Memory
Control Output
Unit Unit
CA-Ch02 2-2
MAIN MEMORY
Limitations of Main Memory
o Limited Capacity:
0
1
2
3
o Volatility:
N-2
N-1
SEQUENTIAL AND DIRECT ACCESS
MEMORY
Sequential and Direct Access Memory
o E.g. o E.g.
– Music tape cassette – Optical disk
– VHS cassette – Hard Disk
o Usage: o Usage:
– Application where data retrieval
– Application where process needs needed more direct e.g. balance
data storage in sequence record in banks
– Bill generation, – HDD
MAGNETIC DISK
Magnetic Disk
o Disk substrate coated with magnetizable material
(iron oxide)
8
Magnetic Disk
o Glass Substrate - benefits
Improved surface uniformity
• Increases reliability
Reduction in surface defects
• Reduced read/write errors
Better stiffness
Better shock/damage resistance
9
Data Organization and Formatting
o Concentric rings or tracks
o Tracks divided into sectors
o Minimum block size is one sector
o May have more than one sector per block
14
Disk Data Layout - Tracks
15
Disk Data Layout - Tracks
Inter Track
Gaps
Tracks
16
Multiple Platters
17
Tracks and Cylinders
18
Storage Capacity
o Storage capacity of a disk system
= Number of recording surfaces
× Number of tracks per surfaces
× Number of sectors per track
× Number of bytes per sector
Storage Capacity - Example
o Number of plates = 10
o Tracks per plates = 2655
o Sectors per track = 125
o 512 bytes per sector
o Terminal
o Input/Output
o Processing
o Decision
o Flow Lines
o Connectors
Basic Flowchart Symbols
Example Read
input data
o A student appears for
examination consisting of Add marks of all
total 10 subjects with each subject giving
Total
having 100 marks.
o The student’s roll no.,
Percentage =
name, and marks obtained Total/10
in various subjects are input
data. Write
o Draw a flowchart to output data
calculate the percentage-
marks-obtained by the End
student, and to print it with
the roll number and name.
Start
Example-2 Read
input data
End
Advantages & Limitations
Advantages Limitations
o Better Communication o Time consuming
o Effective Analysis o Change in logic sometime
o Effective Synthesis results in redrawing the
o Proper Documentation whole flowchart.
Modification is difficult.
o Efficient Coding
o No standards about the
o Systematic Debugging amount of detail that
o Systematic Testing should be included.
Computing Fundamentals
Operating Systems
What is an OPERATING SYSTEM?
o Integrated set of programs
o Controls the resources of the computer
o Provides user interface
Primary Objectives
o Make a Computer easier to use
o Manage the Resources of the Computer
Make a Computer easier to use
o Put a layer of software on top of the
machine/hardware.
o To hide details of the hardware resources.
Logical Architecture of a Computer
System
Users
Other
S/W
Operating
System
Computer
Hardware
Manage the Resources of the
Computer
o Managing of Resources include
Keeping track of the resource usage
Granting resource requests
Accounting of resource usage
Conflict management
Efficient and fair usage of system resources
MAIN FUNCTIONS OF AN OS
Main Functions of an OS
1) Process Management
2) Memory Management
3) File Management
4) Device Management
5) Security
6) Command Interpretation
1) Process Management
o Process:
A program in execution
o A process requires certain resources like:
CPU time,
Memory space,
Files,
I/O devices
2. Memory Management
o A program is loaded in memory for execution.
o OS
Keeps tracks of I/O requests for process
Issues command to I/O devices
Data transmission
Interface of I/O devices with the rest of the system
5. Security
o Access control to computer
o Data and information security on the computer
6. Command Interpretation
o Command based on simple language to manage
the computer