Bits, bytes and digital information. Lecture 2 COMPSCI111/111G

Similar documents
Introduction to the Use of Computers

Overview. ELEC2041 Microprocessors and Interfacing. Lecture 7: Number Systems - II. March 2006.

Where we are going (today)

Where we are going (today)

Where we are going (today)

Learning Programme Fundamentals of data representation AS Level

Where are we? Compiler. translating source code (C or Java) Programs to assembly language And linking your code to Library code

COSC 6385 Computer Architecture Storage Systems

CS61C : Machine Structures

CS61C : Machine Structures

EMBEDDED SYSTEMS. Part I: Introduction and Hardware

Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee

Are Computers Smart? To a programmer: Lecture #1 Introduction & Numbers Andy Carle. Are Computers Smart? What are Machine Structures?

COSC 6385 Computer Architecture. Storage Systems

CS61C : Machine Structures

Lecture (01) Introduction Number Systems and Conversion (1)

COSC 6374 Parallel Computation. Parallel I/O (I) I/O basics. Concept of a clusters

CS61C : Machine Structures

Here is a diagram of a simple computer system: (this diagram will be the one needed for exams) CPU. cache

ITEC 1011 Introduction to Information Technologies

levels (layers) of abstraction

large units some names for large numbers CIS 2107 Chapter 2 Notes Part 1

CIS 2107 Chapter 2 Notes Part 1. Representing and Manipulating Information

CS61c Midterm Review (fa06) Number representation and Floating points From your friendly reader

CS61C : Machine Structures

COMP 102: Computers and Computing

Common Number Systems

data within a computer system are stored in one of 2 physical states (hence the use of binary digits)

2. Integers. 9 * celsius / Celsius to Fahrenheit. Precedence. (9 * celsius / 5) + 32

2. Integers. 9 * celsius / Celsius to Fahrenheit. Precedence. (9 * celsius / 5) + 32

2. Integers. 9 * celsius / Celsius to Fahrenheit. Precedence. (9 * celsius / 5) + 32

CS61C : Machine Structures

CS61C : Machine Structures

College of Computer and Information Sciences Department of Computer Science. CSC 220: Computer Organization. Unit1 Number Systems

CS 261 Fall Binary Information (convert to hex) Mike Lam, Professor

Goals for this Week. CSC 2400: Computer Systems. Bits, Bytes and Data Types. Binary number system. Finite representations of binary integers

Chapter 1. Data Storage Pearson Addison-Wesley. All rights reserved

ENGIN 112 Intro to Electrical and Computer Engineering

Data Compression Techniques

CS61C : Machine Structures

CS61C : Machine Structures

Lecture 1: What is a computer?

Chapter 1. Computer Systems

2nd Paragraph should make a point (could be an advantage or disadvantage) and explain the point fully giving an example where necessary.

Fundamentals of Programming

CSC 170 Introduction to Computers and Their Applications. Lecture #1 Digital Basics. Data Representation

Contents Slide Set 9. Final Notes on Textbook Chapter 7. Outline of Slide Set 9. More about skipped sections in Chapter 7. Outline of Slide Set 9

30000BC Palaeolithic peoples in central Europe and France record numbers on bones. 5000BC A decimal number system is in use in Egypt.

Booting, Partitioning and File Systems. Part I. Booting and hard disks. Booting. Table of Contents. Nothing is what it seems.

Mechatronics MECH 1340 Digital Fundamentals & PLCs Introduction

Colour and Number Representation. From Hex to Binary and Back. Colour and Number Representation. Colour and Number Representation

4. Number Representations

Switching to AQA from Edexcel

Slide Set 8. for ENCM 369 Winter 2018 Section 01. Steve Norman, PhD, PEng

Sir Sadiq s computer notes for class IX. Chapter no 4. Storage Devices

Computer Systems. IGCSE OCR AQA Edexcel Understand the term. embedded system and how an Purpose of embedded system

The Mathematics of Big Data

Switching to AQA from OCR

Imperial College London Department of Computing

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Computer Arithmetic-II. Signed binary numbers

Booting, Partitioning and File Systems. Part I. Booting and hard disks. Booting. Table of Contents. Nothing is what it seems.

Digital Media. Lecture 2: SemesterOverview. Georgia Gwinnett College School of Science and Technology Dr. Mark Iken

AQA GCSE Computer Science PLC

The Free Internet. Questions to Ponder On. Packet Switching Network. Circuit Switch vs Packet Switch. Circuit Switching

The Design of C: A Rational Reconstruction

What's in a computer?

The Design of C: A Rational Reconstruction"

Fundamentals of Programming (C)

"Digital Media Primer" Yue- Ling Wong, Copyright (c)2011 by Pearson EducaDon, Inc. All rights reserved.

LOGIC DESIGN. Dr. Mahmoud Abo_elfetouh

Electronic Data and Instructions

Representing Information. Bit Juggling. - Representing information using bits - Number representations. - Some other bits - Chapters 1 and 2.3,2.

AMath 483/583 Lecture 2. Notes: Notes: Homework #1. Class Virtual Machine. Notes: Outline:

AMath 483/583 Lecture 2

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. Exam 1 Review

card slots CPU socket Monitor Computer case houses CPU (Central Processing Unit), CPU central power supply, DVD drive, etc processing unit Keyboard

Objectives. Connecting with Computer Science 2

Pluggable Authentication Module (2) directory. /etc/pam.d. config files with sections. auth authentication functions

FA269 - DIGITAL MEDIA AND CULTURE

Introduction to the Mathematics of Big Data. Philippe B. Laval

ELEG3923 Microprocessor Ch.0 & Ch.1 Introduction to Microcontroller

Part I. Booting and hard disks. Booting, Partitioning and File Systems. Booting. Table of Contents. Nothing is what it seems.

The Design of C: A Rational Reconstruction

The Design of C: A Rational Reconstruction" Jennifer Rexford!

1.3 Systems of numeration: To represent quantities in the different systems of numeration, specific symbols are used, which are also called ciphers.

Final Labs and Tutors

Random Access Memory (RAM)

CHAPTER 2 - DIGITAL DATA REPRESENTATION AND NUMBERING SYSTEMS

INTRODUCTION TO COMPUTERS

Review: ISA. Review: Compiling Applications. Computer Architecture ELEC3441. Instruction Set Architecture (1) Computer Architecture: HW/SW Interface

Example 1: Denary = 1. Answer: Binary = (1 * 1) = 1. Example 2: Denary = 3. Answer: Binary = (1 * 1) + (2 * 1) = 3

CSC 310, Fall 2011 Solutions to Theory Assignment #1

Building Java Programs Chapter 1

Information Science 1

Digital Media. Daniel Fuller ITEC 2110

Bytes and codes. everyday life and Second World War. Mars Lycée du Bois d Amour POITIERS

Unit 2 Digital Information. Chapter 1 Study Guide

Teaching KS3 Computing. Session 3 Theory: More on binary and representing text Practical: Introducing IF

Module 1: Information Representation I -- Number Systems

Transcription:

Bits, bytes and digital information Lecture 2 COMPSCI111/111G

Today s lecture Understand the difference between analogue and digital information Convert between decimal numbers and binary numbers

Analogue vs digital information Information in the real world is continuous Continuous signal Weight shown Real Weight Information stored by a computer is digital Represented by discrete numbers Weight shown Real Weight

Encoding information Real world information is stored by a computer using numbers Visual information Image Pixels 1. Give each pixel colour a number. 2. Let the computer draw the numbers as coloured pixels (eg. black = 0). 11111111111111111111111 01111111111111111111111 00001111111111111111111 00000011111111111111111 00000000011111111111111 44444000001111111111111 75444000000011111111111 55554401000000111111111 33367544000000011111111 22283554444000000111111 99928357544000000011111 99999233657504000001111 99999983666554400000011 99999928338674400000001

Encoding information Sound information Sound Waveform Samples 1. Give each sample a number (height of green box). 2. Let the computer move the loudspeaker membrane according to the samples.

Numbers and Computing Numbers are used to represent all information manipulated by a computer. Computers use the binary number system: Binary values are either 0 or 1. We use the decimal number system: 0 to 9 are decimal values.

Number Systems Base: Specifies the number of digits used by the system. Binary is base 2. Decimal is base 10. Positional notation: Describes how numbers are written. dd nn dd nn 1 dd 1 Most significant digit Least significant digit

Positional Notation Any number can be expressed as: dd nn bb nn 1 + dd nn 1 bb nn 2 + + dd 1 bb 0 where base. dd ii is the digit at position ii, and bb is the

Decimal Examples 657 6 10 2 + 5 10 1 + 7 10 0 600 + 50 + 7 = 657 9308 9 10 3 + 3 10 2 + 0 10 1 + 8 10 0 9000 + 300 + 0 + 8 = 9308

Storing Decimal Numbers in a Computer Series of dials: Each dial goes from 0 to 9. Information is stored digitally: Finite number of states 10 per dial. No in-between states. Decimal number system: 1 st dial from right: 10 0 2 nd dial from right: 10 1 3 rd dial from right: 10 2 etc. 6 10 2 + 3 10 1 + 8 10 0 = 638

Exercises The following two questions relate to dials that have 10 different states, as discussed in the previous slide. Given a machine that uses 4 dials, how many different numbers can we represent? If we want to represent 256 different values, how many dials do we need?

Switches A dial is complicated. Each dial has 10 different states (0 9). Physically creating circuits that distinguish all states is complicated. Would need to distinguish 10 different strengths of electricity (voltages). Switches are simple. Each switch is off or on (0 or 1). Physically creating the circuits is easy. Switch off: electrical current cannot flow. Switch on: electrical current can flow.

Bits and Bytes Each binary number is known as a Binary digit, or bit. A bit can be either a 0 or a 1 Bits are used in groups. A group of eight bits is referred to as a byte.

Using Binary Numbers How many different values/states can we have with: 1 bit: 2 bits: 3 bits: 0 1 00 000 01 001 10 010 11 011 100 101 110 111

Exercises How many different values can we represent with a byte? If we want to represent 30 different values, how many bits would we need?

Converting binary to decimal 110 1 2 2 + 1 2 1 + 0 2 0 4 + 2 + 0 = 6 10110 1 2 4 + 0 2 3 + 1 2 2 + 1 2 1 + 0 2 0 16 + 0 + 4 + 2 + 0 = 22

Converting from decimal to binary 35 106 2 35 2 17 1 2 8 1 2 4 0 2 2 0 2 1 0 0 1 Read the remainders from the bottom up. 2 106 2 53 0 2 26 1 2 13 0 2 6 1 2 3 0 2 1 1 0 1 Read the remainders from the bottom up. 35 is 100011 in binary 106 is 1101010 in binary

Exercises What is the decimal equivalent of 101111? What is the binary equivalent of 123?

Prefixes A group of 8 bits is a byte A group of 4 bits is a nibble Bytes are the common unit of measurement for memory capacity There are two sets of prefixes: Decimal Binary

Decimal prefixes 10 n Prefix Symbol Decimal 1 none 1 10 3 kilo K 1000 10 6 mega M 1,000,000 10 9 giga G 1,000,000,000 12 10 tera T 1,000,000,000,000 15 10 peta P 1,000,000,000,000,000 18 10 exa E 1,000,000,000,000,000,000 21 10 zetta Z 1,000,000,000,000,000,000,000

Binary prefixes n 2 Prefix Symbol Decimal 2 0 none 1 10 2 kibi Ki 1024 20 2 mebi Mi 1,048,576 30 2 gibi Gi 1,073,741,824 40 2 tebi Ti 1,099,511,627,776 50 2 pebi Pi 1,125,899,906,842,624 60 2 exbi Ei 1,152,921,504,606,846,976 70 2 zebi Zi 1,180,591,620,717,411,303,424

Prefixes in Computer Science Both decimal and binary prefixes are used in Computer Science Decimal prefixes are preferred because they are easier to calculate, however binary prefixes are more accurate Binary prefix Decimal prefix Value (bytes) 8 bits 1 byte same 1 KiB (1 x 2 10 bytes) 1 KB (1 x 10 3 bytes) 1024 1000 1 MiB (1 x 2 20 bytes) 1 MB (1 x 10 6 bytes) 1,048,576 1,000,000

Example hard disk sizes A 160GB hard disk is equivalent to 149.01GiB 160GB = 160 x 10 9 149.01GiB = (160 x 10 9 ) 2 30

Exercises Which has more bytes, 1KB or 1KiB? How many bytes are in 128MB?

Summary Computers use the binary number system We can convert numbers between decimal and binary Decimal prefixes and binary prefixes are used for counting large numbers of bytes