Cs160 chapter 1

Post on 02-Jun-2015

636 views 0 download

Tags:

Transcript of Cs160 chapter 1

DATA STORAGE

Chapter 1

1.1 BITS AND THEIR STORAGE

Data Storage1-2

BITS AND BIT PATTERNS

Bit: Binary Digit (0 or 1)

Bit Patterns are used to represent

information. Numbers

Text characters

Images

Sound

And others

1-3

BOOLEAN OPERATIONS

Boolean Operation: An operation that manipulates

one or more true/false values

Specific operations

AND

OR

XOR (exclusive or)

NOT

1-4

THE BOOLEAN OPERATIONS AND, OR, AND XOR

(EXCLUSIVE OR)

1-5

GATES

Gate: A device that computes a Boolean operation

Often implemented as (small) electronic circuits

Provide the building blocks from which computers are

constructed

VLSI (Very Large Scale Integration)

1-6

A PICTORIAL REPRESENTATION OF AND, OR, XOR, AND NOT

GATES AS WELL AS THEIR INPUT AND OUTPUT VALUES

1-7

FLIP-FLOPS

Flip-flop: A circuit built from gates that can store one bit.

One input line is used to set its stored value to 1

One input line is used to set its stored value to 0

While both input lines are 0, the most recently stored value is

preserved

1-8

A SIMPLE FLIP-FLOP CIRCUIT

1-9

1.2 MAIN MEMORY

Data Storage1-10

MAIN MEMORY CELLS

Cell: A unit of main memory (typically 8 bits

which is one byte) Most significant bit: the bit at the left (high-order) end

of the conceptual row of bits in a memory cell

Least significant bit: the bit at the right (low-order) end

of the conceptual row of bits in a memory cell

1-11

THE ORGANIZATION OF A BYTE-SIZE MEMORY CELL

1-12

MAIN MEMORY ADDRESSES

Address: A “name” that uniquely identifies

one cell in the computer’s main memory The names are actually numbers.

These numbers are assigned consecutively starting at

zero.

Numbering the cells in this manner associates an order

with the memory cells.

1-13

MEMORY CELLS ARRANGED BY ADDRESS

1-14

MEASURING MEMORY CAPACITY

Kilobyte: 210 bytes = 1024 bytes Example: 3 KB = 3 times1024 bytes

Sometimes “kibi” rather than “kilo”

Megabyte: 220 bytes = 1,048,576 bytes Example: 3 MB = 3 times 1,048,576 bytes

Sometimes “megi” rather than “mega”

Gigabyte: 230 bytes = 1,073,741,824 bytes Example: 3 GB = 3 times 1,073,741,824 bytes

Sometimes “gigi” rather than “giga”

1-15

1.3 MASS STORAGE

Data Storage1-16

MASS STORAGE

On-line versus off-line

Typically larger than main memory

Typically less volatile than main memory

Typically slower than main memory

1-17

MASS STORAGE SYSTEMS

Magnetic Systems

Disk

Tape (all but obsolete)

Optical Systems

CD

DVD

Blu-Ray

Flash Drives

Solid State Drives (SSDs)

1-18

MAGNETIC DISKS

1-19

GAP BETWEEN HEAD AND PLATTER

1-20

Head

Smoke

Particle

Human

Hair

Dust

Particle

DISK PERFORMANCE

1-21

Disk Performance

Seek time

Rotational latency

Transfer rate

OPTICAL DISKS

1-22

CD AND DVD TRACK COMPARISON

1-23

CD DVD

FILES

A file is a named collection of bits

Files are often stored in pieces

1 byte chunks in memory

Sector-sized chunks on disk

1-24

1.4 REPRESENTING INFORMATION AS BIT

PATTERNS

Data Storage1-26

REPRESENTING TEXT

Each character (letter, punctuation, etc.) is

assigned a unique bit pattern

ASCII

American Standard Code for Information Interchange

Uses patterns of 7-bits to represent most symbols used in

written English text

128 (27) unique characters

Unicode

Uses patterns of 16-bits to represent the major symbols used

in languages world side

65,536 (216) possible characters

ISO

International Organization for Standardization

4,294,967,296 (232) possible characters

1-27

“HELLO.” IN ASCII

1-28

REPRESENTING NUMERIC VALUES

Binary: a number system using only the digits 0 (zero) and 1 (one)

Maps well to the internal characteristics of the computer

Limitations of computer representations of numeric values

Overflow: happens when a value is too big to be represented

Truncation: happens when a value is between two representable values

1-32

REPRESENTING IMAGES

1-33

Bit map techniques

Pixel: short for “picture element”

RGB

Luminance and chrominance

Vector techniques

Scalable

TrueType and PostScript

SCALABLE VS. BITMAPPED FONTS

1-34

A SOUND WAVE REPRESENTED BY THE SEQUENCE 0,

1.5, 2.0, 1.5, 2.0, 3.0, 4.0, 3.0, 0

1-35

1.5 THE BINARY SYSTEM

Data Storage1-36

THE BASE TEN AND BINARY SYSTEMS

1-37

DECODING THE BINARY REPRESENTATION 100101

1-38

FINDING THE BINARY REPRESENTATION OF 13

1-39

BINARY ADDITION

1-40

DECODING THE BINARY REPRESENTATION 101.101

1-41

1-42

There are 10 kinds of people in

the world: those who understand

binary and those who don’t.

HEXADECIMAL NOTATION

Hexadecimal notation: A shorthand notation for long bit patterns

Divides a pattern into groups of four bits each

Represents each group by a single symbol

Example: 1010 0011 becomes A3

1-43

THE HEXADECIMAL CODING SYSTEM

1-44

1-45

How many people can read hex

if only you and DEAD people

can read hex? 57,006

1.6 STORING INTEGERS

Data Storage1-46

STORING INTEGERS

Two’s complement notation: The most popular

means of representing integer values

Excess notation: Another means of representing

integer values

Both can suffer from overflow errors.

1-47

TWO’S COMPLEMENT

1-48

Fixed number of bits

MSB is sign bit

1 = negative

0 = positive

ENCODING IN TWO’S COMPLEMENT NOTATION

1-49

ADDITION AND SUBTRACTION USING TWO’S

COMPLEMENT

1-50

TAKING ISSUE WITH THE BOOK

“The point is that computers

can make mistakes.”-J. Glenn Brookshear, Computer Science, an Overview, p. 54

1-51

WRONG

TAKING ISSUE WITH THE BOOK

Computers don’t make

mistakes. They do exactly

what you tell them to.

1-61

EXCESS NOTATION

Another system of representing signed integers

1. List all bit patterns of a given length

2. Find the first bit pattern with a 1 in the MSB; this will

represent zero

3. Patterns below our zero represent negative number,

patterns preceding it represent positive numbers

1-62

EXCESS EIGHT CONVERSION TABLE

1-63

1.7 STORING FRACTIONS

Data Storage1-64

STORING FRACTIONS

Floating-point Notation: Consists of a sign bit, a

mantissa field, and an exponent field.

Related topics include

Normalized form

Truncation errors

1-65

FLOATING-POINT NOTATION COMPONENTS

1-66

ENCODING THE VALUE 25⁄8

1-67