Sie sind auf Seite 1von 228

Computing Fundamentals

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

Computer Computer Electronics


Mathematics Science Engineering Engineering Physics

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.

Computer Computer Electronics


Mathematics Science Engineering Engineering Physics

Software
Engineering
CS & Engineering
– Software Engineering:
• Another discipline emerging from CS to build software with
the certainty and predictability of the traditional
engineering disciplines.

Computer Computer Electronics


Mathematics Science Engineering Engineering Physics

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

o An emerging field investigating the vulnerabilities


and weaknesses of computing systems to threats,
and how to insulate and protect systems and
reduce vulnerability.
COMPUTING DISCIPLINES AND
COMPUTING CAREERS
Engineering

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

Basic Computer Architecture


o He who does not hope to win has already lost.
Basic Computer Architecture
o Von Neumann Architecture

o Any Computer performs five basic tasks.


– Inputting
– Storing
– Processing
– Outputting
– Controlling
Structure of von Neumann machine
CPU

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

o The CPUs can differ from one another by the type


of arithmetic and logic operations they can
perform
Control Unit
o Manages and coordinates the operations of all
other components. E.g.
– Read instructions from memory
– Interpret instructions
– Direct ALU to perform operation as per the instruction
Central Processing Unit
o ALU + CU = CPU
The System Concept
o A system is a group of integrated parts having a
common purpose of achieving some objective(s).

o Three main characteristic:


– Has more than one element
– All elements are related logically
– All elements are controlled (and coordinated) to
achieve the system goal(s).
The System Concept
o Since a computer has integrated components (I/O
units, CPU, Memory), that work together to
perform computing functions, it is often referred
to as a computer system.
Computing Fundamentals

Number Systems
Join the Group
o computing_fundamentals-subscribe@yahoogroups.com

o For course outline, lecture plan, assignments and


(possibly) announcements.
Positional vs. Non-Positional Number
Systems
o Non-Positional Number Systems
 Symbols used to represent quantities/values
 E.g.
• Roman numbers system
• Egyptian number system

o Difficult for arithmetic


operations
Positional vs. Non-Positional Number
Systems
o Positional Number Systems

 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

= 0.5 + 0 + 0.125 + 0.0625


= 0.6875

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

o Conversion of Octal fractions into Decimal and


vice versa

 Show three examples each

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)

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 =
 = 1111111-1011000 = 0100111

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

o The ’s o ple e t of a i ary u er is


found by changing all 1s to 0s and all 0s to
1s .

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

o The ’s o ple e t of a i ary u er is fou d


by ADDING 1 to LSB of the ’s o ple e t
o ’s o ple e t = ’s o ple e t +
1 1 1 0 1 0 0 Binary Number

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 Enable Independent development of hardware


and software components for a wide variety of
computers.
Major Codes
o BCD
o EBCDIC
o ASCII
o UNICODE
BCD
BCD Code Decimal Digit A B C D
0 0 0 0 0
o Binary Coded Decimal 1 0 0 0 1
2 0 0 1 0
o One of the early 3 0 0 1 1
computer codes. 4 0 1 0 0
5 0 1 0 1
o Each decimal digit is 6 0 1 1 0
represented by 4-bit
binary equivalent 7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
6
6-bit BCD code
o 2 bits added to the normal BCD to represent the
alphabets.
6-bit
BCD Code Octal BCD Code Octal
BCD Character Zone Digit Equivalent Character Zone Digit Equivalent
code A 1 1 00 0 1 61 S 0 1 0 0 1 0 22
B 1 1 00 1 0 62 T 0 1 0 0 1 1 23
C 1 1 00 1 1 63 U 0 1 0 1 0 0 24
D 1 1 01 0 0 64 V 0 1 0 1 0 1 25
E 1 1 01 0 1 65 W 0 1 0 1 1 0 26
F 1 1 01 1 0 66 X 0 1 0 1 1 1 27
G 1 1 01 1 1 67 Y 0 1 1 0 0 0 30
H 1 1 10 0 0 70 Z 0 1 1 0 0 1 31
I 1 1 10 0 1 71
0 0 0 0 0 0 0 00
J 1 0 0 0 0 1 41 1 0 0 0 0 0 1 01
K 1 0 0 0 1 0 42 2 0 0 0 0 1 0 02
L 1 0 0 0 1 1 43 3 0 0 0 0 1 1 03
M 1 0 0 1 0 0 44 4 0 0 0 1 0 0 04
N 1 0 0 1 0 1 45 5 0 0 0 1 0 1 05
O 1 0 0 1 1 0 46 6 0 0 0 1 1 0 06
P 1 0 0 1 1 1 47 7 0 0 0 1 1 1 07
Q 1 0 1 0 0 0 50 8 0 0 1 0 0 0 10
R 1 0 1 0 0 1 51 9 0 0 1 0 0 1 11
Example
o Write the binary code in BCD to represent the
letter BASE.
 B = 110010
 A = 110001
 S = 010010
 E = 110101
o Therefore the following number will be stored as
BASE as BCD Code:
 110010 110001 010010 110101
Example-2
o Write the binary code in BCD to represent the
letter BASE. Represent the number in octal
 B = 110 010
 A = 110 001
 S = 010 010
 E = 110 101
o BASE i BCD Code represe ted i o tal for :
 62 61 22 65
EBCDIC
EBCDIC
o Extended BCD Interchange Code

o 8-bit code
 2-bits more added to zone bits

 8-bits can be divided into two 4-bit and thus can be


represented by HEX
o Developed by IBM.
Characte BCD Code Hex BCD Code Hex
EBCDIC r Zone Digit Equivalent Character Zone Digit Equivalent
A 11 00 0 0 0 1 C1 S 11 10 0 0 1 0 E2
B 11 00 0 0 1 0 C2 T 11 10 0 0 1 1 E3
C 11 00 0 0 1 1 C3 U 11 10 0 1 0 0 E4
D 11 00 0 1 0 0 C4 V 11 10 0 1 0 1 E5
E 11 00 0 1 0 1 C5 W 11 10 0 1 1 0 E6
F 11 00 0 1 1 0 C6 X 11 10 0 1 1 1 E7
G 11 00 0 1 1 1 C7 Y 11 10 1 0 0 0 E8
H 11 00 1 0 0 0 C8 Z 11 10 1 0 0 1 E9
I 11 00 1 0 0 1 C9
0 11 11 0 0 0 0 F0
J 11 01 0 0 0 1 D1 1 11 11 0 0 0 1 F1
K 11 01 0 0 1 0 D2 2 11 11 0 0 1 0 F2
L 11 01 0 0 1 1 D3 3 11 11 0 0 1 1 F3
M 11 01 0 1 0 0 D4 4 11 11 0 1 0 0 F4
N 11 01 0 1 0 1 D5 5 11 11 0 1 0 1 F5
O 11 01 0 1 1 0 D6 6 11 11 0 1 1 0 F6
P 11 01 0 1 1 1 D7 7 11 11 0 1 1 1 F7
Q 11 01 1 0 0 0 D8 8 11 11 1 0 0 0 F8
R 11 01 1 0 0 1 D9 9 11 11 1 0 0 1 F9
ASCII
ASCII
o American Standard Code for Information
Interchange

o One of the most popular and widely supported


character encoding standard

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.

o Provides a consistent way of encoding multilingual


plain text. This enables data transfer between
different systems without the risk of corruption.

o Defines codes for characters used in all major


languages of the world used for written
communication.
UNICODE
o Can encode million characters

o Part of the code is private, so the programmers/user


can use for their own characters and symbols.

o Consistent with ASCII by keeping the byte value same


as in ASCII characters.

o Specifies an algorithm for presentation of text with


bidirectional behavior.
UNICODE
o Can encode million characters
o Part of the code is private, so the
programmers/user can use for their own code
generation.
UNICODE
o The Unicode Standard has been adopted by such
industry leaders as Apple, HP, IBM, JustSystems,
Microsoft, Oracle, SAP, Sun, Sybase, Unisys
and many others.
o Unicode is required by modern standards such as
XML, Java, ECMAScript (JavaScript), LDAP, CORBA
3.0, WML, etc., and is the official way to
implement ISO/IEC 10646.
Computing Fundamentals

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

o Subtract the divisor (i.e. 5 in the above example) repeatedly till


the result is 0 or less.
o The number of times subtraction is performed is the result e.g.
7 in the above example.
Additive Method of Binary Division
o 33 ÷ 6
1. 33 + (-6) = 27
2. 27+ (-6) = 21
3. 21+ (-6) = 15
4. 15+ (-6) =9
5. 9+ (-6) =3
 3+ (-6) = -3

o Subtract the divisor (i.e. 6 in the above example) repeatedly till


the result is 0 or less.
o If the last remainder is not 0 but less than 0, ignore the last
subtraction. Count the other number of repetitions and that is
the answer i.e. 5 in this case with a remainder 3.
Computing Fundamentals

Boolean Algebra & Logic Circuits


Boolean Algebra
o George Boole (1815-1864)
 Developed algebra for simplifying the representation and
manipulation of logic.
 The algebra called Boolean Algebra

o Claude E Shannon (1916-2001)


 Proposed the use of Boolean Algebra for the design of
relay switching circuits.
 As relaying circuits behave similarly to modern digital
circuits, designers of modern digital computers still use
the same techniques.
FUNDAMENTAL CONCEPTS
Use of Binary Digits
o Variables used in Boolean Algebra can have only
two values:
0
1
Basic Operations
o Logical Addition (OR operator)
o Logical Multiplication (AND operator)
o Complementation (NOT operator)
Truth Table
o A table that shows the resulting output for the all
possible combinations of the given inputs.

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

o This property is known as the principle of duality


in Boolean Algebra
Basic Theorems & Properties of
Boolean Algebra (cont.)
o Theorem 1
 x+x = x
 x.x = x
o Theorem 2
 x+1=1
 x.0=0
o Theorem 3
 x + xy = x
 x(x+y) = x
o Theorem 4
 =
o Theorem 5
 . + = .
 + . = +
o Theorem 6 (De-Morgan)
 + = .
 (x.y = +
BOOLEAN FUNCTIONS
Boolean Function
o An expression formed with Boolean variables,
operators, parenthesis and equal-to sign.

o Each Boolean Variable is either 1 or 0


Boolean Function
o Example:
 W = X + Y .)
 W is the function of variables X, Y, and Z
• W = f(X,Y,Z)

 X, Y & Z are referred to as literals of this function


o This example is in the form of algebraic
expression. However, a Boolean function can also
be represented in the form of Truth Table.
Truth Table to Represent Boolean
Function
o The number of rows in the table to be 2n
 n = number of literals (variables) in the function
o Draw the Truth Table for W = X + Y .)
Truth Table to Represent Boolean
Function
o Draw the Truth Table for W = X + Y .)

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

Binary Logic Binary Arithmetic

1+1=1 1+1=10

Variable is either 0 or 1 Variable may consist of


many digits

22
LOGIC GATES
Logic Gates
o Electronic Circuits that operate on one or more
input signals to produce an output signal

o Electric signals such as voltage or currents exist as


analog signals having value over a given range say
0 to 3 volts.
o But in digital systems, these signals are
interpreted to be either of two values, 0 or 1.

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

 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
AND Gate
o AND Gate

 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
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

o Truth Table for (A + B ’ = C

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

 Truth Table for A . B ’ = C

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

Processor and Memory


Structure of von Neumann machine
CPU

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

o Does not process any data but acts as central nervous


system for other components
o Obtains instructions from Program Memory, Interprets
them, and issues signals that that cause other units to
execute them.
Accumulator
Decoder
Register
Program Control General Purpose
Register Register
Instruction General Purpose
Register Register
Memory Address
Register
Memory Buffer
Register

I/O Register

General Purpose General Purpose


Register Register

Control Unit ALU


Central Processing Unit
Arithmetic Logic Unit (ALU)
o Actual execution of instruction takes place during
data processing

o When CU and ALU are put together, they are


called CPU
INSTRUCTION SET
Instruction Set
o Set of machine instructions
 e.g. add, subtract, compare, etc

o Machine specific. Instruction Sets for one


machine/CPU will not work for another one.

o Backward compatibility
REGISTERS
Registers
o Special memory units
o Used for intermediate data transfers and
temporary storage of instruction and information

o Length of registers = number of bits it can store


o The length of a register is commonly known as
the word length of the CPU
Some Common Registers
o Memory Address Register (MAR)
o Memory Buffer Register (MBR)
o Program Control Register (PC)
o Accumulator Register (A)
o Instruction Register (I)
o Input/Output Register (I/O)
Memory Address Register (MAR)
o Holds the address of active memory location
o Loaded from PC when the system receives an
instruction from memory.
Memory Buffer Register (MBR)
o Holds content of the accessed memory word.
o Instruction  IR
o Data  AC or I/O
Program Control Register (PC)
o Holds address of next instruction to be executed

o Sequential processing of instruction unless


condition arise.
Accumulator Register (A)
o Holds data on which the system has to operate,
intermediate results, and results of operations
performed.
Instruction Register (I)
o Holds current instruction under execution.
Input/Output Register (I/O)
o Used to communicate with I/O devices.
EXECUTION OF INSTRUCTION
Execution of Instruction

Fetch Decode

Execute
Execution of Instruction
Instruction
Read

Load Address Send to


of Next Decoder and
Instruction MAR

Instruction Instruction
Execution interpretation
PROCESSOR SPEED
Processor Speed
o Clock Cycle
 A series of electronic pulses for synchronization of
digital computers

o In general, higher the clock speed of the


Processor, better is the performance.
Processor Speed
o Normally used to measure performance of workstations
and larger 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

Secondary Storage Devices


Structure of von Neumann machine
CPU

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

Sequential Access Direct Access


o Arrival at a desired storage o Arrival at a desired storage location
location is preceded by is direct.
sequencing through other o Any storage location can be
locations. accessed at random.
o Access time varies according to o Access time to any location is
location. (almost) equal.

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)

o Substrate used to be aluminium


 Now glass

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 Disk space = ((10x2)-2)x2655x125x512


o = 3 GB appr.
Computing Fundamentals

Planning the Computer Program


Computer Program
o Sequence of instructions
o Written in computer language
PURPOSE OF PROGRAM PLANNING
Purpose of Program Planning
o The sequence of instruction is very important.

o A correct sequence (logic) will result in correct


program
o An incorrect sequence (logic) will result in an
incorrect program.

o Therefore, the program must be planned before


writing it.
ALGORITHM
Algorithm
o A step-by-step description of how to arrive at a
solution to a given problem.

o It refers to the logic of the program.

o It is the sequence of instruction that when


executed in the specific sequence will give the
desired results.
Representation of Algorithm
o As programs
o As flowchart
o As pseudo code
FLOWCHARTS
Flowcharts
o A pictorial representation of an algorithm.

o Used for visually organizing a sequence of steps


necessary to solve a problem.
Flowchart Symbols
o Boxes of different shapes denote different type of
instructions.

o Terminal
o Input/Output
o Processing
o Decision
o Flow Lines
o Connectors
Basic Flowchart Symbols

Terminal Input/Output Processing

Decision Flow Lines Connectors


Start

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

o 50 student in the class


Add marks of all
appears for examination subject giving
in the previous Total
example.
o Draw a flowchart to Percentage =
Total/10
calculate the
percentage-marks- Write
obtained by each output data
student, and to print it
NO 50
with the roll number printed
and name. ?
YES

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 Several programs are running at the same time.

o OS manages allocation and de-allocation of


memory space to programs.
3) File Management
o Data and information stored in files.

o Organizing, storage, retrieval, naming, sharing


and protection of files is done by OS.
4. Device Management
o I/O devices are connected with computer.

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

o With commands, user do not need to concern


about the hardware details of the system

Das könnte Ihnen auch gefallen