COSC1078 Introduction to Information Technology Lecture 10 Binary Representation
description
Transcript of COSC1078 Introduction to Information Technology Lecture 10 Binary Representation
![Page 1: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/1.jpg)
Lecture 10: Binary Representation Intro to IT
COSC1078 Introduction to Information Technology
Lecture 10
Binary RepresentationJames Harland
![Page 2: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/2.jpg)
Lecture 10: Binary Representation Intro to IT
Introduction
Who is this bloke?
![Page 3: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/3.jpg)
Lecture 10: Binary Representation Intro to IT
Introduction
![Page 4: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/4.jpg)
Lecture 10: Binary Representation Intro to IT
Overview Questions?
WebLearn Test 1
Assignment 1
Binary Representation
Questions?
![Page 5: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/5.jpg)
Lecture 10: Binary Representation Intro to IT
Introduction to IT1 Introduction 2 Images3 Audio4 Video WebLearnTest 1 5 Binary Representation Assignment 16 Data Storage7 Machine Processing8 Operating Systems WebLearn Test 19 Processes Assignment 210 Internet11 Internet Security WebLearn Test 312 Future of IT Assignment 3, Peer and Self Assessment
![Page 6: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/6.jpg)
Lecture 10: Binary Representation SE Fundamentals
Questions?
How did you spend 6-8 hours on this course last week? This week?
![Page 7: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/7.jpg)
Lecture 910: Binary Representation Intro to IT
Assessment Process Submit all assignments via Blackboard in the
Learning Hub Assignment 1 due 11.59pm Sunday 1st April Assignment 2 due 11.59pm Sunday 6th May Assignment 3 due 11.59pm Sunday 27th May Late assignments attract a penalty of 10% per
day late, up to a maximum of 50%
![Page 8: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/8.jpg)
Lecture 10: Binary Representation Intro to IT
Assignment Assignment will be in three parts Overall task is to produce a video Groups of up to 3 Assessed by final video and group blog Part 1: images and audio (end of week 5) Part2: hardware (end of week 9) Part 3: reflection, research (end of week 12)
![Page 9: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/9.jpg)
Lecture 910: Binary Representation Intro to IT
Assignment 1
Use GIMP (or a similar tool) to perform some manipulations on an image
Use Audacity to perform some manipulations on sound
Use a movie making tool to produce something like (and much better than!) ‘Lord of the Controllers 1 & 2’
Email me your group and its name so that I can set up a blog on the Learning Hub
![Page 10: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/10.jpg)
Lecture 10: Binary Representation Intro to IT
Overview 01010100001010101010100110100010101001101001010010100011100010101010100101111001001010…
![Page 11: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/11.jpg)
Lecture 10: Binary Representation Intro to IT
History … Babbage’s Difference Engine (1849) Babbage’s Analytical Engine (1837-1871, never built) Turing’s Universal Machine (1936, mathematical model) Turing digital Boolean-logic multiplier (1937) Colossus (1943, destroyed 1945) ENIAC (1946) Von Neumann architecture (c. 1945) EDVAC (1949) CSIRAC (1949)
![Page 12: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/12.jpg)
Lecture 10: Binary Representation Intro to IT
Computer Memory
Cells of 8 bits each (one byte)
Most significant bit
Least significant bit
……
address
![Page 13: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/13.jpg)
Lecture 10: Binary Representation Intro to IT
Random Access Memory (RAM) Random access means any cell can be accessed at
any time (and in any order)
Volatile – contents cleared when machine is switched off
Very fast compared to other forms of memory
DRAM: dynamic RAM (replenishes charges constantly)
SDRAM: synchronous DRAM – faster still
Often have small very fast caches and registers
![Page 14: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/14.jpg)
Lecture 9: Data Storage Devices Intro to IT
Magnetic Disk Thin spinning metal disk with magnetic coating
Each disk contains a number of circular tracks
Often several disks stacked on top of each other
Cylinders made up of tracks made up of sectors
Can have very large storage this way
Slow access time!
![Page 15: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/15.jpg)
Lecture 9: Data Storage Devices Intro to IT
Magnetic Disk (Hard Disk)
Seek time: move heads from one track to anotherLatency time: half time for complete disk rotationAccess time: seek time + latency timeTransfer rate: rate data can be read from disk
`Typical’ Hard disk
Seek time: 2ms to 15msLatency time: 8ms to 20msTransfer rate: 0.5 GB per second
Sounds fast, but is actually quite slow …
![Page 16: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/16.jpg)
Lecture 9: Data Storage Devices Intro to IT
Optical Disks (CDs, DVDs)
Laser readers rather than magnetic ones
Disks more error-tolerant than magnetic ones
Type Features Date StorageCD “compact disk” 1984 800MBDVD Multiple layers 1995 15GBBlu-ray `blue laser’
(405 vs 650 nm)2004 100GB
![Page 17: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/17.jpg)
Lecture 9: Data Storage Devices Intro to IT
Flash Drives Disks of all sorts are slow compared to other
circuits
Flash drives ‘write’ small electronic circuits
Eventually decay after many changes of data
Suitable for slow-changing data, not main memory
Portable and much more resilient than disks
![Page 18: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/18.jpg)
Lecture 9: Data Storage Devices Intro to IT
Older Storage Types
Magnetic tape
`Floppy’ disk (5.25’’ disk)
3.5’’ disk
![Page 19: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/19.jpg)
Lecture 10: Binary Representation Intro to IT
Binary Codes
“Meet me at Fred’s”23412.43434343-620
00 111 001
![Page 20: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/20.jpg)
Lecture 10: Binary Representation Intro to IT
ASCII
American Standard Code for Information Interchange
7-bit patterns to represent letters (upper and lower case) numbers , . , ; “ $ % @ * & ! ? < > …
Total of 128 different characters
![Page 21: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/21.jpg)
Lecture 10: Binary Representation Intro to IT
ASCII
01001000 H01100101 e01101100 l01101100 l01101111 o00101110 .
Hello!
Unicode: uses 16 bits, can do Chinese, Japanese & Hebrew characters
![Page 22: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/22.jpg)
Lecture 10: Binary Representation Intro to IT
NumbersRepresented in binary notation
25 in ASCII is 00110010 00110101 8 bits per digit seems too much!
Can represent 256 different numbers in 8 bits …
Don’t want to add, multiply etc. in ASCII …
Remember that 1 + 1 = 10 …
![Page 23: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/23.jpg)
Lecture 10: Binary Representation Intro to IT
Two’s Complement
How do you store negative numbers?
Bit pattern Value011 3010 2001 1000 0111 -1110 -2101 -3100 -4
![Page 24: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/24.jpg)
Lecture 10: Binary Representation Intro to IT
Two’s Complement
Bit pattern Value
011 3010 2001 1000 0111 -1110 -2101 -3100 -4
0 first means +ve (sign bit)1 first means –ve+ve: Count from 0 up to 01n-1
-ve: Start from 1n down to 10n-1
3 is 011, -3 is 1012 is 010, -2 is 1101 is 001, -1 is 111
![Page 25: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/25.jpg)
Lecture 10: Binary Representation Intro to IT
Two’s Complement
Bit pattern Value
011 3010 2001 1000 0111 -1110 -2101 -3100 -4
1 + 2: add in obvious way3 – 1: calculate as 3 + (-1)011 + 111 = 1010Answer is 010, ie 2. Can add and subtract with the same circuits
![Page 26: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/26.jpg)
Lecture 10: Binary Representation Intro to IT
Excess Notation
Bit pattern Value
111 3110 2101 1100 0011 -1010 -2001 -3000 -4
A different encoding of the numbers“naive” bit pattern encodes 4 more than actual value100 (looks like 4) encodes 0101 (looks like 5) encodes 1110 (looks like 6) encodes 2
![Page 27: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/27.jpg)
Lecture 10: Binary Representation Intro to IT
Floating Point
sign bitMantissa
exponent
1 bit for sign3 bits for exponent4 bits for mantissa
100.101
![Page 28: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/28.jpg)
Lecture 10: Binary Representation Intro to IT
Floating Point
01011001 means +ve 0.1001 shifted 101 place= 1.001
Mantissa: digit sequence (1st digit always 1) Exponent: where to put the . This is generally given in ‘excess’ notation
Binary form of 2.423 x 104
![Page 29: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/29.jpg)
Lecture 10: Binary Representation Intro to IT
Truncation Errors
Beware adding small numbers to large ones!Finite length of encoding means that sometimes digits are lostNot often a problem, but can be …
![Page 30: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/30.jpg)
Lecture 10: Binary Representation Intro to IT
Parity Bits
Add a ‘parity bit’ to each byte Odd parity: make total of 1s in all 9 bits odd Even parity: make total of 1s in all 9 bits even If parity is wrong, then an error has occurred
![Page 31: COSC1078 Introduction to Information Technology Lecture 10 Binary Representation](https://reader035.fdocuments.net/reader035/viewer/2022081520/56816334550346895dd3ba53/html5/thumbnails/31.jpg)
Lecture 10: Binary Representation Intro to IT
Conclusion
Get Assignment and WebTest done this week
Do online quizzes later this week
Keep reading! (book particularly)