Comp 1001 Introduction to Information Technology & Computer Architecture Wednesday 12-1Dr. Joe Carthy http://www.cs.ucd.ie/staff/ jcarthy/home/
Comp 1001
Introduction to Information Technology & Computer Architecture
Wednesday 12-1Dr. Joe Carthy
http://www.cs.ucd.ie/staff/jcarthy/home/
Comp 1001: IT & Architecture - Joe Carthy
2
Course Outline• Introduction to Information Technology
– Hardware and Software– I/O and Storage devices– CPU – RAM– Information Representation:
• ASCII codes• Binary and Hexadecimal Numbers
– Computer Networks– Operating Systems
Comp 1001: IT & Architecture - Joe Carthy
3
Course Outline Continued
• Computer Architecture and Assembly Language– CPU structure – Introduction to Assembly Language (8086)– Instruction Set– Basic Assembly Language Programs– Fetch-Execute Cycle– Pipelining– Memory: RAM access and Cache Memory
• Computer performance evaluation• Practicals
Comp 1001: IT & Architecture - Joe Carthy
4
Course Outcomes At the end of this course
Students should have a grasp of– functional components of a computer system– information representation – assembly language instructions – instruction execution– CPU structure and functioning– knowledge of performance evaluation
Comp 1001: IT & Architecture - Joe Carthy
5
Recommended Texts
• Recommended Texts:• Computers (Tools for the Information Age), Brief Edition,
H.L. Capron, Prentice Hall
• Introduction to Assembly Language Programming and Computer Architecture, J. Carthy, ITP
• Web Notes
http://www.cs.ucd.ie/staff/jcarthy/home/
Comp 1001: IT & Architecture - Joe Carthy
6
Simple Model of a Computer System
• Hardware– Physical components that make up a
computer system• System: interconnected set of devices that
function as a unit
• Software– Computer programs that allow you use a
computer
Comp 1001: IT & Architecture - Joe Carthy
7
Simple Model of a Computer SystemVersion 1
Monitor
and
Keyboard
Disk
Unit
Printer
Modem
Phone
Socket
Computer
Mouse
Tape
Unit
CD-ROM
Speakers
Comp 1001: IT & Architecture - Joe Carthy
8
Simple Model of a Computer SystemVersion 2
Memory
Processor
Monitor
and
Keyboard
Disk
Unit
Printer
Computer
Cable
Mouse
System Bus
Modem
Phone
Socket
Comp 1001: IT & Architecture - Joe Carthy
9
System Devices
• Classified as:– Storage devices: store information
• RAM• Disk• CD/DVD
– Input/Output (I/O) devices: carry info to/from Computer• Monitor (screen)• Printer• Mouse/Keyboard• Speakers
Comp 1001: IT & Architecture - Joe Carthy
10
Review Questions
• What is a computer system ?• Explain the difference between hardware and
software• What are the two major device classes ?• What is a peripheral device ?• What is the function of the processor ?• What is the function of memory (RAM) ?• What are the major devices ?• What is a bus ?
Comp 1001: IT & Architecture - Joe Carthy
11
Information Representation
• How is “information” represented in a computer system ?
• What are the different types of information– Text– Numbers– Images
• Video• Photographic
– Audio
Comp 1001: IT & Architecture - Joe Carthy
12
Everything is in Binary !(1’s and 0’s)
• Computers are digital devices - they can only manipulate information in digital (binary) form.
• Easy to represent 1 and 0 in electronic, magnetic and optical devices
• Only need two states• High/low• On/off• Up/down• etc
• All information in a computer system is• Processed in binary form• Stored in binary form• Transmitted in binary form
Comp 1001: IT & Architecture - Joe Carthy
13
How is information converted to Binary form
• I/O and Storage Devices are digital• I/O devices convert information to/from
binary– A keyboard converts the character “A” you
type into a binary code to represent “A”– E.g. “A” is represented by the binary code
01000001– Monitor converts 01000001 to the “A” that
you read
Comp 1001: IT & Architecture - Joe Carthy
14
Bits and Bytes
• One binary digit i.e. 1 or 0 is called a bit• A group of 8 bits is one byte• Byte is the unit of storage measurement
Number of Bytes Unit
1024 bytes (210 bytes) 1 Kilobyte (Kb)
1024 Kb (220 bytes) 1 Megabyte (Mb)
1024 Mb (230 bytes) 1 Gigabyte (Gb)
1024 Gb (240 bytes) 1 Terabyte (Tb)
1024 Tb (250 bytes) 1 Petabyte (Pb)
Comp 1001: IT & Architecture - Joe Carthy
15
Representing Text- ASCII Code
• Textual information is made up of individual characters e.g.
• Letters: – Lowercase: a,b,c,..z – Uppercase: A,B,C..Z
• Digits: 0,1,2,..9 • Punctuation characters: ., :, ; ,, “, ’ • Other symbols: -, +, &, %, #, /,\,£, etc.).
Comp 1001: IT & Architecture - Joe Carthy
16
Representing Text- ASCII Code• Each character is represented by a unique binary code.• ASCII is one international standard that specifies the
binary code for each character.• American Standard Code for Information Interchange• It is a 7-bit code - every character is represented by 7 bits• There are other standards such as EBCDIC but these are
not widely used.• ASCII is being superceded by Unicode of which ASCII is
a subset. Unicode is a 16-bit code.
Comp 1001: IT & Architecture - Joe Carthy
17
Sample ASCII Codes
Char ASCII Decimal Char ASCII Decimal
NUL 000 0000 00 BEL 000 0111 07
LF 000 1010 10 CR 000 1011 13
0 011 0000 48 SP 010 0000 20
1 011 0001 49 ! 010 0001 21
2 011 0010 50 “ 010 0010 22
9 011 1001 57
A 100 0001 65 a 110 0001 97
B 100 0010 66 b 110 0010 98
C 100 0011 67 c 110 0011 99
Y 101 1001 89 y 111 1001 121
Z 101 1010 90 z 111 1010 122
Comp 1001: IT & Architecture - Joe Carthy
18
Comments on ASCII Codes
• Codes for A to Z and a to z form collating sequences– A is 65, B is 66, C is 67 and so on– A is 97, b is 98, c is 99 and so on
• Lowercase code is 32 greater than Uppercase equivalent• Note that digit ‘0’ is not the same as number 0
– ASCII is used for characters– Not used to represent numbers (See later)
• Codes 0 to 30 are typically for Control Characters– Bel - causes speaker to beep !– Carriage Return (CR); LineFeed (LF)– Others used to control communication between devices
• SYN, ACK, NAK, DLE etc
Comp 1001: IT & Architecture - Joe Carthy
19
Review
• All information stored/transmitted in binary• Devices convert to/from binary to other forms
that humans understand• Bits and Bytes• Kb, Mb, Gb, Tb and Pb are storage metrics• ASCII code is a 7-bit code to represent text
characters• Text “numbers” not the same as “maths”
numbers• Do not add phone numbers or get average of PPS
numbers !
Comp 1001: IT & Architecture - Joe Carthy
20
Review Questions
• How is information transmitted inside a computer• Why do we use binary in computers• What is an ASCII code used for• How big is an ASCII code• What is the ASCII code for: A, ‘0’, ‘a’• What is a collating sequence• What is a control character - give an example• What is Unicode and why is it used• What is a bit ? A byte ?• How many bytes in: Kb, Mb, Gb, Tb, Pb
Comp 1001: IT & Architecture - Joe Carthy
21
Representing Numbers: Integers
• Humans use Decimal Number System• Computers use Binary Number System• Important to understand Decimal system before looking at binary
system• Decimal Numbers - Base 10
– 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9– Positional number system: the position of a digit in a number
determines its value– Take the number 1649
• The 1 is worth 1000• The 9 is worth 9 units
– Formally, the digits in a decimal number are weighted by increasing powers of 10 i.e. they use the base 10. We can write 1649 in the following form:
• 1*103 + 6*102 + 4*101 + 9*100
Comp 1001: IT & Architecture - Joe Carthy
22
Representing Numbers: Integers
• weighting: 103 102 101 100
• Digits 1 6 4 9• 1649 = 1*103 + 6*102 + 4*101 + 9*100
• Least Significant Digit: rightmost one - 9 above– Lowest power of 10 weighting– Digits on the right hand side are called the low-order digits (lower
powers of 10).
• Most Significant Digit: leftmost one - 1 above– Highest power of 10 weighting– The digits on the left hand side are called the high-order digits (higher
powers of 10)
Comp 1001: IT & Architecture - Joe Carthy
23
Representing Numbers: Decimal Numbers
• Largest n-digit number ?– Made up of n consecutive 9’s (= 10n -1 )– Largest 4-digit number if 9999– 9999 is 104 -1
• Distinguishing Decimal from other number systems such as Binary, Hexadecimal (base 16) and Octal (base 8)
– How do we know whether the number 111 is decimal or binary
– One convention is to use subscripts– Decimal: 11110 Binary:1112 Hex: 11116 Octal: 1118
• Difficult to write use keyboard
– Another convention is to append a letter (D, B, H, O)• Decimal: 111D Binary:111B Hex: 111H Octal: 111O
Comp 1001: IT & Architecture - Joe Carthy
24
Representing Numbers: Binary Numbers
• Binary numbers are Base 2 numbers– Only 2 digits: 0 and 1
– Formally, the digits in a binary number are weighted by increasing powers of 2
– They operate as decimal numbers do in all other respects
– Consider the binary number 0101 1100
• Weight 27 26 25 24 23 22 21 20
• bits 0 1 0 1 1 1 0 0
• 01011100 = 0*27 + 1*26 + 0*25 + 1*24 + 1*23 + 1*22 + 0*21 + 0*20
• = 0 + 6410 + 0 + 1610 + 810 + 410 + 0 + 0• = 9210
Comp 1001: IT & Architecture - Joe Carthy
25
Representing Numbers: Binary Numbers
• Leftmost bit is the most significant bit (MSB). – The leftmost bits in a binary number are referred to as the
high-order bits.
• Rightmost bit is the least significant bit (LSB). – The rightmost bits in a binary number are referred to as the
low-order bits. – Largest n-bit binary number ?
• Made up of n consecutive 1’s (= 2n -1)• e.g. largest 4-bit number: 1111 = 24 -1 = 15
Comp 1001: IT & Architecture - Joe Carthy
26
Representing Numbers: Binary Numbers
• Exercises
• Convert the following binary numbers to decimal:• (i) 1000 1000 (ii) 1000 1001 (iii) 1000 0111• (iv) 0100 0001 (v) 0111 1111 (vi) 0110 0001
• Joe Carthy Formatting Convention• In these notes we insert a space after every 4 bits to make the numbers
easier to read
Comp 1001: IT & Architecture - Joe Carthy
27
Representing Numbers: Converting Decimal to Binary
• To convert from one number base to another:– you repeatedly divide the number to be converted by the new base – the remainder of the division at each stage becomes a digit in the new
base – until the result of the division is 0.
• Example: To convert decimal 35 to binary we do the following:
• Remainder• 35 / 2 1• 17 / 2 1• 8 / 2 0• 4 / 2 0• 2 / 2 0• 1 / 2 1• 0
• The result is read upwards giving 3510 = 1000112.
Comp 1001: IT & Architecture - Joe Carthy
28
Representing Numbers: Converting Decimal to Binary
• Exercise: Convert the following decimal numbers to binary
• (1) 64 (2) 65 (3) 32 (4) 16 (5) 48
• Shortcuts• To convert any decimal number which is a power of 2, to binary,
simply write 1 followed by the number of zeros given by the power of 2. • For example,
32 is 25, so we write it as 1 followed by 5 zeros, i.e. 10000; 128 is 27 so we write it as 1 followed by 7 zeros, i.e. 100 0000.
• Remember that the largest binary number that can be stored in a given number of bits is made up of n 1’s.
• An easy way to convert this to decimal, is to note that this is the same as 2n - 1. • For example, if we are using 4-bit numbers, the largest value we can represent
is 1111 which is 24-1, i.e. 15
Comp 1001: IT & Architecture - Joe Carthy
29
Representing Numbers: Converting Decimal to Binary
• Binary Numbers that you should remember because theyoccur so frequently
Binary Decimal
111 7
1111 15
0111 1111 127
1111 1111 255
Comp 1001: IT & Architecture - Joe Carthy
30
Review
• Decimal Number System - Base 10• Significant Digits• Binary Number System - Base 2• Notation (B,D,H,O)• Binary to Decimal• Decimal to Binary• Shortcuts and Common Binary Numbers
• Review Questions• What is a positional number system ?• What is the MSB and the LSB. Give an example of each one.• Show how the weights of the bits in an
– 8-bit binary number
– 16-bit binary numbe
• What is the weight of the MSB in (a) 8-bit number (b) 16-bit number (c) 32-bit number• Convert 48D, 65D, 31D, 15D to binary• Convert 1111 0111B, 1010 1010B and 1110 0111B to decimal
Comp 1001: IT & Architecture - Joe Carthy
31
Hexadecimal Number System
• Base-16 number System• 16 digits: 0, 1, 2, .., 9, A, B, C, D, E, F.• We use the letters A to F to represent numbers 10 to 15 using a single symbol• A = 10; B = 11; C = 12; D = 13; E = 14; F = 15;• Use H at right hand side to indicate Hexadecimal
• Used because – binary numbers are very long and so are error prone– Easy to convert between hexadecimal and binary than between decimal and binary
• Example: Convert 2FAH to decimal
weighting: 162 161 160
digits 2 F A2FA = 2 * 162 + F * 161 + A * 160
= 2 * 162 + 15 * 161 + 10 * 160
= 256 + 240 + 10
= 50610
Comp 1001: IT & Architecture - Joe Carthy
32
Hexadecimal Number System
Binary Hexadecimal Decimal 0000 0 0 0001 1 1 0010 2 2 0011 3 3 0100 4 4 0101 5 5 0110 6 6 0111 7 7 1000 8 8 1001 9 9 1010 A 10 1011 B 11 1100 C 12 1101 D 13 1110 E 14 1111 F 15
Comp 1001: IT & Architecture - Joe Carthy
33
Hexadecimal Number System
• Example 2: Convert FFFH to decimal
weighting: 162 161 160
digits F F F2FA = F * 162 + F * 161 + F * 160
= 15 * 162 + 15 * 161 + 15 * 160
= 3840 + 240 + 15
= 409510
• Example 3: Convert 65D to Hexadecimal• 65 / 16 = 4 Remainder 1• 4 / 16 = 0 Remainder 4
– 65D = 41H
• Exercise: Convert 97D, 48D, 255D to Hexadecimal
Comp 1001: IT & Architecture - Joe Carthy
34
Hexadecimal Number System
• Hexadecimal to Binary
• Convert each Hex digit to a 4-bit binary number
• Example: 7FAH
7 F A0111 1111 1010
7FA = 0111 1111 1010B
• Exercise: Convert FFH, FEH, BBH to binary
Comp 1001: IT & Architecture - Joe Carthy
35
Hexadecimal Number System
• Binary to Hexadecimal
• Break binary numbers into groups of 4-bits from right hand side• Pad with 0’s on left if necessary• Convert each group of 4-bits to its equivalent Hex digit
• Example 1: 111100111011B
1111 0011 1011Decimal 15 3 11Hex F 3 B
111100111011B = F3BH
• Exercise: Convert 11 1111 1010B; 111 1101 1111B and 1111 1111 1111 1111B
to Hexadecimal
Comp 1001: IT & Architecture - Joe Carthy
36
Hexadecimal Number System
• Binary to Hexadecimal
• Break binary numbers into groups of 4-bits from right hand side• Pad with 0’s on left if necessary• Convert each group of 4-bits to its equivalent Hex digit
• Example 1: 111100111011B
1111 0011 1011Decimal 15 3 11Hex F 3 B
111100111011B = F3BH
• Exercise: Convert 11 1111 1010B; 111 1101 1111B and 1111 1111 1111 1111B to Hexadecimal
Comp 1001: IT & Architecture - Joe Carthy
37
Signed Numbers
• How do we represent negative numbers ?
• Humans use a symbol to indicate number sign: “-” or “+”• In computer we only have binary: 1’s and 0’s .
• Two common methods for representing signed numbers
– Signed Magnitude– Two’s Complement (2’s Complement)
• In the following assume we are working with 8-bit numbers
• Signed Magnitude• We designate the leftmost bit i.e the MSB as a sign bit• The sign bit indicates whether a number is positive or negative• 0 sign bit => positive number• 1 sign bit => negative number• The remaining bits give the magnitude of the number
Comp 1001: IT & Architecture - Joe Carthy
38
Signed Numbers
• Example +15 and -15 as 8-bit numbers
• +15 => 0 000 1111B MSB = 0 => +
• -15 => 1 000 1111B MSB = 1 => -
• Note the magnitude is comprised of 7 bits
• Largest positive number is
0111 1111 => +127
• Largest negative number is
1 111 111 => -127
• Two representations of zero ! 0 000 0000 and 1 000 0000
Comp 1001: IT & Architecture - Joe Carthy
39
Signed Numbers: 2’s Complement
• In a complementary number system each number has a unique representation.
• Two’s complement is a complementary number system used in computers • It is the most commonly used method for representing signed numbers
• Uses only one representation of zero: 0000 0000
• Uses a sign bit as for signed magnitude – 0 sign bit => positive number– 1 sign bit => negative number
• In the case of positive numbers, the representation is identical to that of signed magnitude,
• the sign bit is 0 and the remaining bits represent the positive number.
• In the case of negative numbers, the sign bit is 1 but the bits to the right of the
sign bit do not directly indicate the magnitude of the number.
Comp 1001: IT & Architecture - Joe Carthy
40
Signed Numbers: 2’s Complement
• In negative numbers the sign bit carries a negative weight while all other bitscarry a positive weight e.g. the 2’s complement number 1000 0011B is weighted as follows
Bits 1 0 0 0 0 0 1 1Weights -128 +64 +32 +16 +8 +4 +2 +1Value = -128 + 2*1 + 1*1 = -128 +3 = -125D
So 1000 0011B = -125D
Exercise: Convert the 2’s complement numbers 1000 0111B and 1000 1111B to decimal.
Comp 1001: IT & Architecture - Joe Carthy
41
Signed Numbers: 2’s Complement
• Example 2: The 2’s complement number 1111 1111B
Bits 1 1 1 1 1 1 1 1Weights -128 +64 +32 +16 +8 +4 +2 +1Value = -128 + 64 + 32 +16 + 8 +4 + 2 _+1
= -128 +127 = -1D
• In 2’s complement each number has a unique representation i.e. the negative representation of a number uses a completely different bit pattern than its positive counterpart.
• In any number system: +x - x = 0
Example: +1 - 1 = 0
In 2’s complement: 0000 0001B 1111 1111B ------------------ 0000 0000B
Comp 1001: IT & Architecture - Joe Carthy
42
Signed Numbers: 2’s Complement
• 2’s Complement Arithmetic
• In 2’s Complement, we do not need subtraction to compute x - y• We simply add -y to x to get the result.
• This makes it easier to design the hardware to implement 2’s arithmetic
• It much more complicated with signed magnitude e.g to compute +2 - 6 we must always subtract the smaller number from the larger one and then take the sign of the larger number.
• Quick Conversion to/from 2’s Complement
• Use the rule: Flip the bits and Add 1
Comp 1001: IT & Architecture - Joe Carthy
43
Signed Numbers: 2’s Complement
• Quick Conversion to/from 2’s Complement
• Use the rule: Flip the bits and Add 1
• Example 1 Convert 2’s complement number 1111 1111B to decimal
• Step 1: Flip the bits: Change 1’s to 0’s and change all 0’s to 1’s(complement of 1 is 0; complement of 0 is 1)
• 1111 1111B => 0000 0000B
• Step 2: Add 1
• 0000 0000B + 1B => 0000 0001B => 1D
Remember the sign bit was 1 => negative
• So 1111 1111B => -1D
Comp 1001: IT & Architecture - Joe Carthy
44
Signed Numbers: 2’s Complement
• Example 2: Convert -1D to 2’s complement
• First convert 1D to binary => 0000 0001B
• Step 1: Flip the bits
• 0000 0001B => 1111 1110B
• Step 2: Add 1
• 1111 1110B + 1B => 1111 1111B =>
-1D => 1111 1111B
• Exercise: Convert the following • 2’s complement numbers to decimal: 1111 1110; 1000 0000; 100 0001; 1111 0000• Decimal to 2’s complement: -128 ; -65; -2
Comp 1001: IT & Architecture - Joe Carthy
45
Bit Pattern Unsigned 2's Complement
0000 0000 0 0
0000 0001 1 1
0000 0010 2 2
• • •
•••
0111 1110 126 126
0111 1111 127 127
•• •
•• •
1000 0000 128 -128
1000 0001 129 -127
1111 1110 254 -2
1111 1111 255 -1
• 1000 0000B (i.e. -128) is the largest negative 8-bit 2’s complement number
• 0111 1111 (127) is the largest positive 8-bit 2’s complement number
• 256 numbers can be represented using 8-bit two’s complement numbers from -128 to 127.
• There is only one representation for zero.
The table below lists the decimal equivalents of some 8-bit 2’s complement
and unsigned binary numbers.
Comp 1001: IT & Architecture - Joe Carthy
46
Number Range and Overflow
• The range of numbers (called the number range) that can be stored in a given number of bits is important.
• Given an 8-bit number, we can represent – unsigned numbers in the range 0 to 255 (0 to 28-1) and – two’s complement numbers in the range -128 to +127 (-27 to 27).
• Given a 16-bit number, we can represent – unsigned numbers in the range 0 to 65,535 (0 to 216 -1) and – two’s complement numbers in the range -32768 to 32767 (-215 to 215-1).
• In general given an n-bit number, we can represent – unsigned numbers in the range 0 to 2n -1 and
– two’s complement numbers in the range -2n-1 to 2n-1 -1
• Exercise: What is the number range of 4-bit, 10-bit, 20-bit, 30-bit and 32-bit numbers ?
Comp 1001: IT & Architecture - Joe Carthy
47
Number Range and Overflow
• The magnitude of an unsigned number doubles for every bit added
• 10 bits can represent 1024 numbers (1K)• 11 bits => 2048 numbers (2K)• 12 bits => 4096 numbers (4K)• ….• 16 bits => 64K numbers• ..• 20 bits => 220 => 1 Mb• 21 bits => 2 Mb• ..• 24 bit => 16Mb• ..• 30 bits => 230 => 1 Gb• 31 bits => 2Gb• 32 bits => 4 Gb
Comp 1001: IT & Architecture - Joe Carthy
48
Number of bits in Memory Address• The maximum amount of memory that a processor can access is determined
by the number of bits that the processor uses to represent a memory address.
• This determines the maximum memory address that can be accessed i.e. is a limiton the maximum amount of RAM a computer can use
• For example, a processor that uses 16-bit addresses will only be able to access • up to 65,536 memory locations (64Kb), with addresses from 0 to 65,535.
• A 20-bit address allows up to 220 (1Mb) memory locations to be accessed
• A 24-bit address allows up to 16Mb (224 bytes) of RAM to be accessed
• A 30-bit address allows up to 1Gb (230 bytes) of RAM to be accessed
• A 32-bit address allows up to 4Gb (232 bytes) of RAM to be accessed
• Most PCs now use 32-bit addresses. Original PC (1981) used 20-bit addresses.• Early Macintoshs used 24-bit addresses.
Comp 1001: IT & Architecture - Joe Carthy
49
Review• Hexadecimal: 16 digits: 0 to 9 and A to F. Easy to convert to binary
• Signed Numbers: Signed Magnitude and 2’s Complement
• Sign bit: MSB 1 => negative
• 2 Complement: Flip the bits and add 1.
• Number range is important
• Given an n-bit number, we can represent – unsigned numbers in the range 0 to 2n -1 and
– two’s complement numbers in the range -2n-1 to 2n-1 -1.
• A 20-bit address allows up to 220 (1Mb) memory locations to be accessed
• A 30-bit address allows up to 1Gb (230 bytes) of RAM to be accessed
• A 32-bit address allows up to 1Gb (230 bytes) of RAM to be accessed
Comp 1001: IT & Architecture - Joe Carthy
50
Overflow
• What happens if we attempt to store a larger unsigned value than 255 in 8-bits?
• For example, if we attempt the calculation 70 + 75 using 8-bit two’s complement numbers, the result of 145 (1001 0001B) is a negative number in 2's complement!
• This situation, when it arises is called overflow.
It occurs when we attempt to represent a number outside the rangeof numbers that can be stored in a number of bits.
• Overflow is detected by the hardware of the CPU.
• This allows the programmer to test for this condition in an assembly language program and deal with it appropriately.
Comp 1001: IT & Architecture - Joe Carthy
51
Overflow
• The figure below illustrates the relationship between number range and overflow for 8-bit two’s complement numbers.
Overflow
Region
Number Range
Overflow
Region
0-128 127
Comp 1001: IT & Architecture - Joe Carthy
52
Exercises
• Convert the following two’s complement numbers to decimal:FFFFh ; F000h; 1000h; 1001h
• What is the range of unsigned numbers that can be represented by 20-bit, 24-bit and 32-bit numbers?
• What is the range of numbers that can be represented using 32-bit two’s complement numbers?
• What problem arises in representing zero in signed magnitude?
• What is overflow and how might it occur?
Comp 1001: IT & Architecture - Joe Carthy
53
Note: What does a bit-pattern represent ?
• How can we tell by looking at a number whether it is a two’s complement number or an unsigned number.
Does 1111 1111B represent the decimal number 255 or the number -1?
• The answer is that we cannot tell by looking at a number, how it should be interpreted.
• It is the responsibility of the programmer to use the number correctly. It is important to remember that you can never tell how any byte or longer bit-pattern is to be interpreted by looking at its value alone. It could represent a signed or unsigned number, an ASCII code, a machine code instruction and so on. The context (in which the information stored in the byte is used) will determine how it is to be interpreted.
• Assembly languages provide separate instructions for handling comparisons involving unsigned or signed numbers. It is the programmers responsibility to use the correct instructions.
Comp 1001: IT & Architecture - Joe Carthy
54
Real Numbers: Floating Point Numbers
• A different representation is used for real (usually called floating-point) numbers. • We can write such numbers in scientific notation
• Example: The number 562.42 can be written as 0.56242 x 103.
• We can express any floating-point number as: ± m x rexp
where m is the mantissa, r is the radix and exp is the exponent.
• For decimal numbers the radix is 10 and for binary numbers the radix is 2.
• Since we use binary numbers in a computer system, we do not have to store the radix explicitly when representing floating-point numbers.
This means that we only need to store the mantissa and the exponent of the number to be represented.
Comp 1001: IT & Architecture - Joe Carthy
55
Real Numbers: Floating Point Numbers
• For the number 0.11011011 x 23 only the values 11011011 (mantissa) and 3 (exponent converted to binary) need to be stored. The binary point and radix are implicit.
• A floating-point number is normalised if the most significant digit of the mantissa is non-zero as in the above example.
Any floating-point number can be normalised by adjusting the exponent appropriately. For example, 0.0001011 is normalised to 0.1011 x 2-3.
• To represent 0, as a floating-point number, both the mantissa and the
exponent are represented as zero.
Comp 1001: IT & Architecture - Joe Carthy
56
Real Numbers: Floating Point Numbers
• There are various standards (IEEE, ANSI etc.) that define how the mantissa and exponent of a floating-point number should be stored.
• Most standards use a 32-bit format for storing single precision floating-point numbers and a
• 64-bit format for storing double precision floating-point numbers.
• A possible format for a 32-bit floating-point number uses a sign bit, 23 bits to represent the mantissa and the remaining 8 bits to represent the exponent.
• The mantissa could be represented using either signed magnitude or 2’s complement. The exponent could be in 2’s complement (but another form called excess notation is also used). Thus a 32-bit floating-point number could be represented as follows, where S is the sign bit:
.
Comp 1001: IT & Architecture - Joe Carthy
57
Real Numbers: Floating Point Numbers
General Format and example: 0.1101 1011 x 26
S MantissaExponent
23 bits8 bits1 bit
000 0000 0000 0000 1101 10110 0000 0110
mantissaexponentsign
Comp 1001: IT & Architecture - Joe Carthy
58
Number Representation in Java
KeywordDescription Size/Format
• Integers• byte Byte-length integer 8-bit two's complement• short Short integer 16-bit two's complement• int Integer 32-bit two's complement• long Long integer 64-bit two's complement
• Real numbers• float Single-precision floating point 32-bit IEEE 754• double Double-precision floating point 64-bit IEEE 754
• Other types• char A single character 16-bit Unicode character• boolean A boolean value (true or false) true or false
.
Comp 1001: IT & Architecture - Joe Carthy
59
Number Representation in Java
Range
• Integers• byte -128 to 127 -(27) to 27-1• short -32,768 to 32,767 -(215) to 215-1• int -2,147,483,648 to
2,147,483,467 -(232) to 232-1
• long -9,223,372,036,854,775,808 -(264) to 264-1to 9,223,372,036,854,775,807
• Real numbers• float +/- 1.40239846 * 2-45
to +/- 3.40282347 * 238
• double +/- 4.94065645841246544 * 2-324 to +/- 1.79769313486231570 * 2308
.
Comp 1001: IT & Architecture - Joe Carthy
60
Why use small variables (byte, short) ?
• Programmers use “small” variable types to save memory usage
• Your program occupies memory space. Each variable used occupies one or more storage locations.
• By using byte and short you decrease the amount of RAM required• But modern PCs have hundreds of megabytes of RAM - so who cares about the
few bytes you can save ?• For PC applications these savings are usually of no consequence • BUT most processors are NOT used in computers !• They are embedded in other equipment: phones, stereos, washing machines,
microwaves etc.• Usually these processors have very limited amounts of RAM.• Called micro-controllers• This is where it is important to write programs that are as small as possible and so
to use the most efficient variable types.
.
Comp 1001: IT & Architecture - Joe Carthy
61
Review
• Floating point numbers are represented in scientific notation• In binary: ± m x 2exp
• There are different standards for representing floating point numbers
• There are different precisions: single and double
• Languages like Java and C allow you specify the type of number
• Micro-controllers are embedded processors with some RAM
• Code for micro-controller needs to be designed to use as little RAMas possible.
Comp 1001: IT & Architecture - Joe Carthy
62
Information Representation: Audio - Sound
• Sound waves are analog signals
• Analog signal: continuous signal between a maximum and minimum value
• Digital Signal: Only two possible values: 1 OR 0 (High/Low etc)
• Microphone converts sound to analog electrical signal
• Loudspeaker converts analog electrical signal to sound we can hear
• How can we represent an analog signal in digital form i.e. how do we represent the analog signal as a sequence of bits ?
• Conversely, how do we convert digital signal back to its original analog form
• Use devices called digital-to-analog (DAC) and analog-to-digital (ADC) converters
Comp 1001: IT & Architecture - Joe Carthy
63
Information Representation: Audio - Sound
• ADC samples the value of the electrical signal at regular intervals such as 8000 times per second - sampling rate
• ADC represents each sample as a binary number. These numbers are then stored or transmitted.
• DAC takes these samples and recreates an analog signal that “matches” the samples.
• This re-created signal will NOT be identical to the original BUT may be close enough that the human ear cannot tell the difference
• The sample may typically be represented by an 8-bit number or a 16-bit number (8-bit sampling/16-bit sampling) - sampling precision
• The following examples come from HowStuffWorks website - well worth a visit
• http://entertainment.howstuffworks.com/analog-digital3.htm
Comp 1001: IT & Architecture - Joe Carthy
64
Information Representation: Audio - Sound
• Analog signal
Comp 1001: IT & Architecture - Joe Carthy
65
Information Representation: Audio - Sound
• Sampled signal (1000 samples per sec and 10 gradations per sample)
Comp 1001: IT & Architecture - Joe Carthy
66
Information Representation: Audio - Sound
• Re-created signal in blue (with sharp angles): note there is an error
Comp 1001: IT & Architecture - Joe Carthy
67
Information Representation: Audio - Sound
• More accurate if we increase sampling rate and precision (2000/sec and 20)
Comp 1001: IT & Architecture - Joe Carthy
68
Information Representation: Audio - Sound
• More accurate if we increase sampling rate and precision (4000/sec & 40)
Comp 1001: IT & Architecture - Joe Carthy
69
Information Representation: Audio - Sound
• CD Recording
• In the case of CDs, the sampling rate is 44,100 samples per second with 16-bit samples
• The number of gradations is 65,536 (216)
• At this level, the output of the DAC so closely matches the original waveform that the sound is essentially "perfect" to most human earsbut musical purists hotly debate this contention!!
• CD Storage Capacity• CDs are designed for two sound streams to be recorded (one for each of the speakers on a stereo system). • A CD can store up to 74 minutes of music, so the total amount of digital data that must be stored on a CD is:
• 44,100 samples/(channel*second) * 2 bytes/sample * 2 channels * 74 minutes * 60 seconds/minute = 783,216,000 bytes
Comp 1001: IT & Architecture - Joe Carthy
70
Audio Representation: - Review
• Sound - analog signal
• Microphone converts to electrical signal which is converted to digital signal by ADC
• DAC converts digital signal to analog signal which is converted back to soundby loudspeaker
• Sampling rate: number of samples per second that ADC uses - higher is better
• Precision: number of bits per sample - more is better
• Exercises• Explain using diagrams how sound is represented digitally• What is sampling rate and why is higher sampling rate better• What is precision and why is higher precision better• What precision is used with CDs
Comp 1001: IT & Architecture - Joe Carthy
71
Image RepresentationSee: http://electronics.howstuffworks.com/digital-camera.htm
• Traditional photographic image is represented by analog
• A digital image is simply a sequence of 1s and 0s that represent tiny colored dots
• These dots are called picture elements or pixels and they make up the image.
• You can convert an image to its digital form by using a digital scanner which records light reflected from the image as binary numbers or pixel values
• You can also use a digital camera which samples the light reflected from the subject and stores it in pixel form
• A single image will typically consist of millions of pixels (megapixels)
• Cameras are rated according to the maximum number of pixels the camera is capable of using to represent an image - called the resolution of the camera
• The higher the number of pixels the better the image quality e.g. 3.2 megapixels is used by some cameras
Comp 1001: IT & Architecture - Joe Carthy
72
Image Representation• The key difference between a digital camera and a film-based camera is that the digital
camera has no film. Instead, it has a sensor that converts light into electrical charges -> pixels
• Some typical resolutions that you find in digital cameras today include:
• 256x256 pixels - You find this resolution on very cheap cameras. This resolution is so low that the picture quality is almost always unacceptable. This is 65,000 total pixels.
• 640x480 pixels - This is the low end on most "real" cameras. This resolution is great if you plan to e-mail most of your pictures to friends or post them on a Web site. This is 307,000 total pixels.
• 1216x912 pixels - If you are planning to print your images, this is a good resolution. This is a "megapixel" image size -- 1,109,000 total pixels.
• 1600x1200 pixels - This is "high resolution." Images taken with this resolution can be printed in larger sizes, such as 8x10 inches, with good results. This is almost 2 million total pixels. You can find cameras today with up to 10.2 million pixels.
Comp 1001: IT & Architecture - Joe Carthy
73
Image Representation
• Resolution for Web and E-mail• You may or may not need lots of resolution, depending on what you want to do with your
pictures. If you are planning to do nothing more than display images on a Web page or send them in e-mail, then using 640x480 resolution has several advantages:
• Your camera's memory will hold more images at this low resolution than at higher resolutions.
• It will take less time to move the images from the camera to your computer.
• The images will take up less space on your computer.
• On the other hand, if your goal is to print large images, you need to take high-resolution shots and need a camera with lots of pixels.
• JPEG compression reduces size by a factor of 16 if used
Comp 1001: IT & Architecture - Joe Carthy
74
Image Representation
• Resolution: Printing Pictures• There are many different technologies used in printers. In general, printer manufacturers will
advertise the printer resolution in dots per inch (dpi). .
• The rule of thumb is that you divide your printer's color resolution by about four to get the actual maximum picture quality of your printer.
• So for a 1200 dpi printer, a resolution of 300 pixels per inch would be just about the best quality that printer is capable of.
• This means that with a 1200x900 pixel image, you could print a 4-inch by 3-inch print.
• In practice, though, lower resolutions than this usually provide adequate quality. To make a reasonable print that comes close to the quality of a traditionally developed photograph, you need about 150 to 200 pixels per inch of print size.
Comp 1001: IT & Architecture - Joe Carthy
75
Image Representation
• Kodak recommends the following as minimum resolutions for different print sizes
Comp 1001: IT & Architecture - Joe Carthy
76
Image Representation: Video
• Video may be regarded as sequences of still images and essentially the same techniques are used to represent the images as for photographic images.
• In addition the sound is stored separately, again , in the same fashion as for CDs.
• Compression becomes an important issue for video because of the huge volumeof data involved.
• A set of standards called MPEG (-1,-2,-3, -4) is used for compressing video
• Raw video generates approx. 170Mbps e.g. 10 second video clip uses over 200Mb
• Can reduce this to 100Kbps by using MPEG e.g 10 second clip takes 125Kb
• MPEG makes it feasible to easily store and transmit video
Comp 1001: IT & Architecture - Joe Carthy
77
Image Representation: Review
• Images are represented using pixels
• Resolution refers to number of pixels per image
• Need Megapixel resolution for print quality large images
• Compression is important: JPEG
• Video: sequence of still images
• MPEG compression
• Exercises• How are images represented ? What are pixels ?• What is resolution ? Why is high resolution needed in some cases ? What cases ?• Why is compression important ?
Comp 1001: IT & Architecture - Joe Carthy
78
Information Representation: Summary
• All Information is stored and transmitted in digital form in a computer system
• Text is typically represented by ASCII or Unicode binary codes
• Integers are typically represented as pure binary or 2’s complement binary numbers
• Real numbers are represented in scientific notation form in binary
• Audio is converted to digital (binary) by ADC and from binary to analog by DAC
• Images are represented by pixels which are represented by binary numbers
• Video can be regarded as a combination of Image and Audio representations
Comp 1001: IT & Architecture - Joe Carthy
79
Storage Devices
• One binary digit i.e. 1 or 0 is called a bit• A group of 8 bits is one byte• Byte is the unit of storage measurement
Number of Bytes Unit
1024 bytes (210 bytes) 1 Kilobyte (Kb)
1024 Kb (220 bytes) 1 Megabyte (Mb)
1024 Mb (230 bytes) 1 Gigabyte (Gb)
1024 Gb (240 bytes) 1 Terabyte (Tb)
1024 Tb (250 bytes) 1 Petabyte (Pb)
• Review: Bits and Bytes
Comp 1001: IT & Architecture - Joe Carthy
80
Storage Devices
• Storage devices are may be classified as– Short-term (volatile) or– Long-term (permanent)
• Short-term
– RAM (Main Memory)
Loses contents on power off
• Capacity: n Megabytes• (2004: n = 256 .. 1024 for PCs)
• 100,000 times faster than disk !
• e.g. 27.7 hours is 100,000 times longer than 1 second
• Much more expensive than other storage devices
Comp 1001: IT & Architecture - Joe Carthy
81
Storage Devices
• Long Term (Secondary/Auxiliary)– Information stored for years– No power required to store information
• Disk: Magnetic medium
• Random access storage medium
• Hard Disk– Internal– External (Removable)
• Capacity : n Gigabytes (n = 30 to 100+ Gb for PCs)
Floppy Disk: 1.4MbZip Disk (100/250/750 Mb)
Comp 1001: IT & Architecture - Joe Carthy
82
Storage Devices
• RAID Technology: Redundant Array of Inexpensive Disks
– Use collection of independent disks to do same job as a larger disk.
– Increases availability of data
– Improves access time
– Uses either disk mirroring or striping
– May be hot-swappable
• Capacity: x00 Gb to Tb range
Comp 1001: IT & Architecture - Joe Carthy
83
Storage Devices: Optical Technology
• CD-ROM/CD-R (ROM: Read-Only Memory; CD-R: Recordable)
• Capacity: 650 Mb
• CD-R is an example of WORM technologyWORM: Write Once/Read Many timesAlso have rewriteable CDs - more expensive
• CDs are much slower to access data than magnetic disks• Uses laser to read/write digital data on surface of disk
Comp 1001: IT & Architecture - Joe Carthy
84
Storage Devices: Optical Technology
• DVD: Digital Versatile Disk
• Capacity 4.7 Gb • (or n times 4.7 Gb where n = .5, 2, 4) • At moment - use mainly DVD-ROM
• Also DVD-RAM (rewriteable DVD)
Comp 1001: IT & Architecture - Joe Carthy
85
Storage Devices: Tape Technology
• Tapes: Magnetic and Optical • Slower to access than Disk• Cheaper than disk• Sequential storage medium
• Very good for offline storage• Capacity
– Old: Reel ( <100 Mb)– Cartridge: 100Mb to <10 Gb– DAT: 4Gb upwards
• Optical tape: x Terabytes capacity• fast access relative to other tapes
Comp 1001: IT & Architecture - Joe Carthy
86
Storage Devices: Flash Memory
• Flash memory is a form of non-volatile RAM (NV-RAM)
• USB “disks” e.g. Disgo are small devices that store from 16 MB to 2 GB in this form of memory
• Plug into any USB port
• Most modern PCs and Operating Systems allow you use them without installing additional software (drivers)
• Much more convenient and reliable than Floppy disks
• Also much large capacity than floppy disks
Comp 1001: IT & Architecture - Joe Carthy
87
Storage Devices: Importance of Backups
• Most important storage principle:
Always have a Backup !
• It is almost impossible to overstate the importance of this principle
• Hard disks do and will wear out or breakdown (head crash)• They may also be stolen or lost (with your laptop or desktop)• Files may be deleted by accident/on purpose
• CDs and DVDs are very useful for storing a copy of your hard disk datayour backup copy.
• Traditionally tapes have been used as the standard backup medium
Comp 1001: IT & Architecture - Joe Carthy
88
Storage Devices: Review
• Short and Long-term storage devices• RAM: Short-term x00 to low Gigabyte range
– 100,000 times faster than disk• Disk: Long-term, Magnetic medium
– Widely used– X Gb (X = 30 .. 200 for PCs)
• CD/DVD: Long-term; Optical medium; Very robust– Widely used; Slower than disk– CD: 650 Mb– DVD: 4.7 Gb upwards
• Tape: Long-term; Sequential access; Magnetic; Slow; Cheap– DAT: 4 Gb upwards– Optical: terabyte range
• NV-RAM devices: Long-term– USB : 16 Mb to 2GB
• Always have a Backup
Comp 1001: IT & Architecture - Joe Carthy
89
Input / Output (I/O) Devices
• Data Entry Input Devices
• Keyboard - QWERTY– function keys– numeric keypad
• Pointing Devices– Mouse– Light pen– Joystick– Trackball– Touchpad (notebooks)– Touch Screen
Comp 1001: IT & Architecture - Joe Carthy
90
Input / Output (I/O) Devices
• Data Automation Input Devices– OCR: Optical Character Recognition
• Utility Bills: ESB• Typically use special font e.g. OCR1
– OMR: Optical Mark Recognition
• (e.g. lotto tickets)
– Image scanner • OCR software• DIP: Document Image Processing e.g. for CAO forms
– Bar code Scanner
• Reads an optical code• Universal Product Code: UPC• (supermarket checkouts/ libraries)• Often used as key component of Point-of-Sale system (POS)
Comp 1001: IT & Architecture - Joe Carthy
91
Input / Output (I/O) Devices
• Digital Camera
• Voice recognition• (e.g. Viva Voice by IBM, Dragon)
• Handwriting recognition• HP Ipaq; Palm Pilot
• Smart Cards• contain a processor e.g. Telecom phonecards
• MICR Magnetic ink character recognition• Used on bank cheques
Comp 1001: IT & Architecture - Joe Carthy
92
Output Devices
• Display devices: e.g. computer monitor is what most people use with PCs.
• A computer terminal is made up of a monitor and a keyboard. It is a dumb device unlike a PC. Terminals may be used to access a mainframe computer.
• Screen size varies from 15 to 27 inches, measured diagonally across the screen.
• Resolution• Images are usually made up of tiny “dots” called pixels (picture
elements). The higher the resolution , the better the quality of picture.
Comp 1001: IT & Architecture - Joe Carthy
93
Output Devices
• Resolution may be measured by either – pixel density e.g. .26 or .28– (distance between pixels in millimetres)
or– as a matrix of pixels e.g. 640 x 480– 640 x 480 rows VGA standard– 800 x 600 SVGA standard– 1024 x 768 XGA standard– 1080 x 1024 SXGA standard– 1600 x 1200 UXGA
Comp 1001: IT & Architecture - Joe Carthy
94
Output Devices
• Colour• Most monitors are RGB (red-green-blue) i.e. form colours by
combinations of primary colours.
• Most monitors produce non-interlaced images i.e all lines are redrawn when the screen is refreshed. TVs produce interlaced images i.e every other line is redrawn on every refresh.
• The screen is usually refreshed 60 times a second.
Comp 1001: IT & Architecture - Joe Carthy
95
Output Devices
• Landscape: Screen is wider than it is high
• Portrait: Screen is higher than it is wide
• CRT versus Flat-Panel• Desktop monitors are typically CRT (cathode-ray tube) devices like TVs,
although flat screens are becoming more popular as they take up less space but are more expensive.
• Notebooks use flat-screens which require less power and are lightweight.
• Flat-screens often use LCD (liquid crystal display) technology.
• Active-matrix LCDs provide sharper images than passive-matrix LCDs but at higher cost.
Comp 1001: IT & Architecture - Joe Carthy
96
Output Devices: Printers
• Variety of Print technologies
• Ink-jet: high quality and very popular: Usually Colour
• Laser (page printer): highest quality – Colour laser printers are much more expensive than black&white
• Cost of ink-jet cartridges/colour toner is an issue in choosing a printer
• Dot-matrix: good quality largely replaced by ink-jet
• Line-printers: Fast, low quality bulk printing on computer paper
Comp 1001: IT & Architecture - Joe Carthy
97
Output Devices: Others
• Plotters: for CAD (Computer Aided Design) output– architectural/engineering drawings– A3 laser printers now also used for these applications
• Speakers• As in sound systems
• Computer Output on Microfilm (COM)• e.g. for archival purposes
Comp 1001: IT & Architecture - Joe Carthy
98
Communications Devices
• Modem: Modulator/demodulator– Uses to allow computers communicate over analog telephone lines– Converts computer digital signals to analog signals and vice versa– Operates at speeds up to 56Kbps – bps = bits per second
• ISDN Card• Digital communication device requires digital phone line• Operates at speeds from 64Kbps, 128 Kbps (home use) to low Megabit range• Much more reliable than modem
• DSL/ADSL Card• Similar to ISDN but operates at much higher speeds (140Kbps to 3 Mbps)
• Network Card (Ethernet card, LAN card): • Short Distances (<1000m) • used inside an organisation like UCD• 10Mbps to 100Mpbs to 1000 Mbps
Comp 1001: IT & Architecture - Joe Carthy
99
Computer System: Storage and I/O Devices
Monitor
and
Keyboard
Disk
Unit
Printer
Modem
Phone
Socket
Computer
Mouse
Tape
Unit
CD-ROM
Speakers
Comp 1001: IT & Architecture - Joe Carthy
100
I/O Devices and Communication Devices: Review
• Data entry– Keyboard, mouse, joystick, light pen, touch pad etc– OCR, OMR, Barcode scanner, DIP, MICR– Digital Camera, Voice, Smart Cards
• Output– Monitor (VGA, SVGA, XGA etc)
• CRT, LCD– Printer
• Inkjet, Laser, Dot-Matrix– Plotter– Speakers
• Communication Devices• Modem• ISDN• ADSL/DSL• Network Card
Comp 1001: IT & Architecture - Joe Carthy
101
Computer Networks
• A computer network is an interconnected collection of computers.
• The goals of a computer network include:
• Resource sharing: programs (O.S., applications), data, equipment(printers, disks) are available to all users of the network regardless of location.
• High availability: By replicating files on different machines and having spare CPUs, users are more immune from hardware/software failure.
• Less cost: Small machines have about 1/10 the power of a mainframe but 1/1000 the cost. A network of such machines can be installed at low cost. It is easy to increase the capacity by adding new machines.
• Communications medium: Users have access to email and the Internet
Comp 1001: IT & Architecture - Joe Carthy
102
Computer Networks
• A Network may be classified as:
– Local Area Network: LAN
• Operates over small geographical area (1 to 2 kms) such as office complex,hospital, university campus e.g. UCD network
• High-speed networks: 10 to 100 Mbps are common but up to 1000MBps (Gigabit)
– Wide Area Network: WAN • Operates over long distances - national or global• e.g. a Bank’s national/international network• Speed depends on communication medium used• From slow 56Kbps to x Mbps
– Also– Tiny Area Network: TAN - e.g. network of a few PCs in the home
– Metropolitan Area Network: MAN: network in a single city
Comp 1001: IT & Architecture - Joe Carthy
103
Client - Server Model
• Networks provide services on one or more computers for all users
• The machines providing a service are called servers.
• The machines (users) using the service are called clients.
• Several servers may be used to replicate data/services so that if one crashes, users can still access their data and the network services.
• Such a Client-Server Model is decentralised
• Example: A LAN with file server(s). Users store files and access software on the file server, but use their own PCs for processing.
• Dedicated servers may also be used for email or for printing: mail servers and print servers.
• One advantage of client-server model is that users can avail of local processing on their own machines as well as the shared services of the network.
Comp 1001: IT & Architecture - Joe Carthy
104
Terminal-Mainframe Model
• Centralised Model
• This model uses a central mainframe computer to do ALL processing
• Users use terminals to access mainframe computer – Terminal is a screen and keyboard (can use a PC)– Terminals can be local or remote (in a different building/city/country)
• Disadvantage: if mainframe crashes or needs to be serviced NO work can be done - single point of failure
• Advantages– Can have enormous computing power to run applications which PCs cannot cope
with– Easier to maintain and secure - as there is only one computer
• Used for – large commercial applications: e.g. banking, insurance
Comp 1001: IT & Architecture - Joe Carthy
105
Terminal-Mainframe Model
• Network Topologies.• Networks can be interconnected in a number of ways
• The method used, determines the shape or topology of the network
• Common topologies include:
– Bus: used in LANs
– Ring: used in LANs
– Star: used in terminal mainframe model
– Single point of failure
– Tree: Land-line phone network
Comp 1001: IT & Architecture - Joe Carthy
106
a) Ring
b) Bus
c) Completed) Loop
e) Tree f) Intersecting Loop
g) Star
Network Topology
Comp 1001: IT & Architecture - Joe Carthy
107
Network Configuration.• The user machines in a network are called hosts.
• The hosts are connected by a subnet
• Subnet carries messages between hosts.
• The subnet is made up of
1. transmission lines (trunks, channels, circuits) and
– transmission lines carry bits
– switching elements (computers).
– switching elements connect the transmission lines
Comp 1001: IT & Architecture - Joe Carthy
108
Broadcast Networks
• In this system a message is broadcast over the network
• All machines have the possibility of receiving the message.
• Each machine has its own unique address and
• typically machine will only "listen" to messages that are sent to
this address
• LANs are usually broadcast networks
• Ethernet is commonest example and is used in UCD
Comp 1001: IT & Architecture - Joe Carthy
109
Point to Point Networks
• Message is transmitted from one computer (point) to another
(point) and so on, until the destination computer is reached.
• This is analogous to the postal system
• Letter is transferred from post-office to post-office and finally to the
addressee.
• WANs usually use point to point
• Message is usually broken into smaller parts or packets
• Each packet is treated as a separate unit for delivery
• Packets can take different routes through the network
o e.g. if one point fails packets can be re-routed
Comp 1001: IT & Architecture - Joe Carthy
110
Data Transmission
• How data is is physically transmitted
• Medium: carries the data e.g. copper wire, glass fibre
• Shannon’s Law
• There is a maximum limit to the amount of data that can be transmitted using any transmission medium.
• Data is transmitted as signals
• The number of signals per second is the frequency of the signal.
• This is measured in Hertz (Hz). – One cycle per second is 1 Hz. – 1,000 cycles per second is 1 KHz– One million cycles per second is 1 MHz.– 1,000 million cycles per second is 1 GHz
Comp 1001: IT & Architecture - Joe Carthy
111
Data Transmission
• Bandwidth
– Bandwidth of a medium is the maximum range of frequencies that can be transmitted using that medium
– determines the maximum amount of data that can be transmitted
• A phone cable might have a bandwidth of .5 to 4 MHz
• An optic fibre has a bandwidth of up to 108 MHz.
– The higher the bandwidth the more data that can be transmitted per second
Comp 1001: IT & Architecture - Joe Carthy
112
Transmission Media
• Copper Wires Twisted Pair (TP) Coaxial Cable (coax) - two types (thick and thin!)
10-Base-5; 10-Base-2 standards Used with Ethernet 10 to 100 Mbps
Fibre Optic Glass fibre Up to 1000 Mbps
Wireless (x Kbps to x Mbps) Radio
wireless LAN (wi-fi) 10-50 Mbps in UCD Microwave Infrared
Comp 1001: IT & Architecture - Joe Carthy
113
Twisted Pairs (tp)– They are used in telephone network for the local loop (connection between your
home phone and the local telephone exchange).
– They carry electrical signals.
– A tp consists of two insulated copper wires (1mm diameter) twisted to reduce electrical interference.
– Capacity: dependent on the distances involved but can be up to several Mbps over a few Kms.
– For example ISDN (Integrated Services Digital Network) lines offer speeds from 64Kbps to over 1 Mbps
– More recently (2003), DSL (Digital Subscriber Line) and in particular ADSL (Asymmetric DSL) lines are available to home users with speeds of 1.5 to 6 Mbps.
– ISDN and ADSL both use digital transmission and so must use a digital line unlike the standard analog telephone line where a modem is used. You must install an ISDN card or an ADSL card into your PC to use an ISDN or ADSL line.
– A Network Interface Card (NIC) is used to connect a PC to a LAN
Comp 1001: IT & Architecture - Joe Carthy
114
Twisted Pairs (tp)
– TPs may be shielded (stp) or unshielded (utp) with the shielded having extra insulation.
– They are also classified into Category-5 (CAT-5) and Category-6 (CAT-6).
– CAT-5 can carry 10 or 100 Mbps (10/100Mbps) over short distances e.g. up to 100 metres approx. The communications standard used in this case is called 10/100-Base-T.
– This is the type of cable that is often used in building to connect PCs to a LAN.
– Usually, the CAT-5 cable connects to a either a hub or a switch which is less than 100 metres from each PC. There may be a hub for each floor/laboratory in a building.
– CAT-6 cable operates at 100/1000Mbps (Gigabit Ethernet) and is typically used to interconnect hubs. It is more expensive than CAT-5 cable.
Comp 1001: IT & Architecture - Joe Carthy
115
Three Floor Building with CAT-6 Cable Backbone connecting LANs on each floor
Switch
UPS
Servers
First Floor
Hub
PCs to hub via CAT-5
PCs Third Floor
Switch
Router
Router CAT-6 Backbone Cable
Duct to carry cable
Comp 1001: IT & Architecture - Joe Carthy
116
Twisted Pairs (tp)
– Large organisations frequently have a so-called "backbone" network that interconnects separate LANs in different buildings/rooms as in the diagram below.
– Over short distances CAT-6 cable may be used for the backbone but optic fibre is also often used as it can operate at higher speeds over longer distances.
– A UPS is also shown in the diagram.
– UPS: Uninterruptable Power Supply - provides battery backup power in event of power failure
– A UPS can cost from as little as €200 to €x,000 depending on amount of time it can keep system running
– In life critical systems, backup generators are necessary to cope in the event of power failure
Comp 1001: IT & Architecture - Joe Carthy
117
Types of Transmission
There are three types of transmission.
• 1. Simplex: information is transmitted in one direction only and the roles of transmitter and receiver are fixed. This form is not used for conventional data transmission.
• 2. Half Duplex (HDX): transmission is allowed in both directions but in only one direction at a time. Data communication systems that use the telephone network sometimes transmit in HDX.
• 3. Full Duplex (FDX): sender/receiver can transmit and receive from each other at the same time. In order to transmit in FDX, the user usually has private direct lines.
Comp 1001: IT & Architecture - Joe Carthy
118
Types of Transmission
SIMPLEX
HALF DUPLEX
FULL DUPLEX
Comp 1001: IT & Architecture - Joe Carthy
119
Data Transmission: Multiplexing
• With high bandwidth channels it is possible to share the channel so that a number of users can use the channel at the same time- called multiplexing.
• For example 4 users could each operate terminals at 1Mbps connected to mainframe over a single 4Mbps line as shown in the figure below.
• The 4 lines from the terminals are connected to a multiplexer which is connected to another multiplexer by the 4Mbps line. The second multiplexer de-multiplexes the signal onto 4 separate lines for the computer.
• Multiplexing is also used for voice transmission where optic fibres and microwave cable can handle from 8000 to 16000 simultaneous conversations.
• There are a number of types of multiplexing.
• Two common ones are Time Division Multiplexing (TDM) and Frequency Division Multiplexing (FDM).
Comp 1001: IT & Architecture - Joe Carthy
120
Data Transmission
• Multiplexing
Computer
MUX
MUXHigh
SpeedLine
Comp 1001: IT & Architecture - Joe Carthy
121
Data Transmission: Modulation
• Analog Transmission: Dominated the last 100 years and is still widely used in phone network.
• Network designers made use of telephone network which was aimed at voice transmission. This is very poor for computer networking e.g. 2 computers connected by a direct cable can achieve a data rate of 100 Mbps upwards with very low error rate.
• Using phone lines, 56 Kbps is the maximum transmission speed with a relatively high error rate.
• Modems• Phone lines deal with frequencies of 300 to 3000 Hz. A computer outputs a digital
serial stream of bits (1’s, 0’s). • A modem is a device that accepts such a bit stream and converts it to
an analog signal, using modulation. • It also performs the inverse conversion.
• Thus two computers can be connected using two modems and phone line.• The serial interface between the modem and computer is governed by the
RS-232 standard (also known as the CCITT V24 standard).
Comp 1001: IT & Architecture - Joe Carthy
122
Data Transmission: Modulation
• A transmitting modem sends a continuous signal (tone) in the range 1000 to
2000 Hz to the receiving modem.
• This carrier signal is modulated to an analog signal as in the figure below.
• Its amplitude, frequency, phase or a combination can be modulated .
DC SIGNALS
FROM TERMINAL
OR COMPUTER
MODEM
MODEM
DC SIGNALS
TO A TERMINAL
OR COMPUTER
Comp 1001: IT & Architecture - Joe Carthy
123
Frequency Modulation
• One common form of modulation Frequency Modulation (FM).
• In FM, the carrier signal is modulated between two different frequencies (say 1200Hz and 2200Hz) without affecting the amplitude in accordance
with the digital signal that it must send.
0 1 1 0 0 1 0
Comp 1001: IT & Architecture - Joe Carthy
124
Review
• What is a network and why use one• Client Server and Terminal-Mainframe Models• LANs and WANs• Network Topology: Bus, Ring and Tree• Broadcast and Point-to-Point Networks• Data Transmission: Bandwidth and Shannon’s Law• Transmission Media: utp, coax, fibre, wireless• Hubs and Cabling• ISDN, ADSL, wi-fi• HDX, FDX, Multiplexing• Modulation