Top Banner
55

2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

Dec 21, 2015

Download

Documents

Maud Ryan
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.
Page 2: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

2Systems Architecture, Fifth Edition

Chapter Goals

• Describe numbering systems and their use in data representation

• Compare and contrast various data representation methods

• Describe how nonnumeric data is represented• Describe common data structures and their uses

Page 3: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

3Systems Architecture, Fifth Edition

Data Representation and Processing

• Capabilities required of any data/information processor–organic, mechanical, electrical, optical:– Recognizing external data and converting it to an

appropriate internal format

– Storing and retrieving data internally

– Transporting data among internal storage and processing components

– Manipulating data to produce desired results or decisions

Page 4: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

4Systems Architecture, Fifth Edition

Automated Data Processing

• Data is converted from native format into a form suitable for the processing device

• Computers represent data electrically and process it with electrical switches

• Laws of electricity can be stated as mathematical equations

• Electronic devices perform computational functions embedded in the equations

Page 5: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

5Systems Architecture, Fifth Edition

A + B = C

Page 6: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

6Systems Architecture, Fifth Edition

Binary Data Representation

• Binary number– Only one of two possible values (0 or 1) per digit

• Reliably transported among computer system components

• Can be processed by two–state electrical devices (relatively easy to design and fabricate)

• Correspond directly with values in Boolean logic

Page 7: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

7Systems Architecture, Fifth Edition

Page 8: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

8Systems Architecture, Fifth Edition

Page 9: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

9Systems Architecture, Fifth Edition

Page 10: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

10Systems Architecture, Fifth Edition

Hexadecimal Notation

• Uses 16 as its base or radix (hex = 6, and decimal = 10)

• Compact; advantage over binary notation• Often used to designate memory addresses

Page 11: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

11Systems Architecture, Fifth Edition

Page 12: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

12Systems Architecture, Fifth Edition

Octal Notation

• Uses base 8 numbering system• Has a range of digits from 0 to 7• Expresses large numeric values in:

– One-third the length of corresponding binary notation

– Double the length of corresponding hexadecimal notation

Page 13: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

13Systems Architecture, Fifth Edition

Goals of Computer Data Representation

• Compactness• Accuracy• Range• Ease of manipulation• Standardization

Page 14: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

14Systems Architecture, Fifth Edition

Goals of Computer Data Representation (continued)

• Compactness– Describes number of bits used to represent a

numeric value

– More compact data representation format; less expense to implement in computer hardware

• Accuracy– Precision of representation increases with number

of data bits used

Page 15: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

15Systems Architecture, Fifth Edition

Goals of Computer Data Representation (continued)

• Ease of manipulation– Machine efficiency when executing processor

instructions (addition, subtraction, equality comparison)

– Processor efficiency depends on its complexity

• Standardization– Ensures correct and efficient data transmission

– Provides flexibility to combine hardware from different vendors with minimal data communication problems

Page 16: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

16Systems Architecture, Fifth Edition

CPU Data Types• Primitive data types

– Integer– Real number– Character– Boolean– Memory address

• Representation format for each type balances compactness, accuracy, ease of manipulation, and standardization

Page 17: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

17Systems Architecture, Fifth Edition

Integers

• A whole number—a value that does not have a fractional part

• Data formats can be signed or unsigned– Determines largest and smallest values that can be

represented

• Excess notation• Two’s complement notation (most common)• Range and overflow

Page 18: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

18Systems Architecture, Fifth Edition

Excess Notation

• Can be used to represent signed integers• Divides a range of ordinary binary numbers in

half; uses lower half for negative values and upper half for nonnegative values

• Always uses a fixed number of bits with the leftmost bit representing the sign (1 for nonnegative and 0 for negative values)

Page 19: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

19Systems Architecture, Fifth Edition

Page 20: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

20Systems Architecture, Fifth Edition

Two’s Complement Notation

• Nonnegative integer values are represented as ordinary binary values

• Compatible with digital electronic circuitry– Leftmost bit represents the sign

– Fixed number of bit positions

– Only two logic circuits required to perform addition on single-bit values

– Subtraction can be performed as addition of a negative value

Page 21: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

21Systems Architecture, Fifth Edition

Range and Overflow

• Overflow– Occurs when absolute value of a computational

result contains too many bits to fit into fixed-width data format

• Avoiding overflow– Double precision data formats

– Careful programming

Page 22: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

22Systems Architecture, Fifth Edition

Range and Overflow

• Choose data format width by balancing:– Numeric range

– Chance of overflow during program execution

– Complexity, cost, and speed of processing and storage devices

Page 23: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

23Systems Architecture, Fifth Edition

Real Numbers

• Contain both whole and fractional components• Require separation of components to be

represented within computer circuitry – Fixed radix point (simple)

– Floating point notation (complex)

Page 24: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

24Systems Architecture, Fifth Edition

Page 25: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

25Systems Architecture, Fifth Edition

Floating Point Notation

• Similar to scientific notation, except that 2 is the base

• value = mantissa x 2exponent

• Trades numeric range for accuracy– Value can have many digits of precision for large

or small magnitudes, but not both simultaneously

• Less accurate and more difficult to process than two’s complement format

Page 26: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

26Systems Architecture, Fifth Edition

Page 27: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

27Systems Architecture, Fifth Edition

Page 28: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

28Systems Architecture, Fifth Edition

Range, Overflow, and Underflow

• Range– Limited by number of bits in a floating point string

and formats of mantissa and exponent fields

• Overflow– Can occur within the exponent

• Underflow– Occurs when absolute value of a negative exponent

is too large to fit within allocated bits

Page 29: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

29Systems Architecture, Fifth Edition

Precision and Truncation

• Precision– Accuracy is reduced as the number of digits

available to store mantissa is reduced

• Truncation– Stores numeric value in the mantissa until available

bits are consumed; discards remaining bits

– Causes an error or approximation which can magnify

– Programmers avoid by using integer types

Page 30: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

30Systems Architecture, Fifth Edition

Processing Complexity

• Floating point formats– Optimized for processing efficiency

– Require complex processing circuitry (translates to difference in speed)

• Programmers never use real numbers when an integer will suffice (speed and accuracy)

Page 31: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

31Systems Architecture, Fifth Edition

Character Data

• Represented indirectly by defining a table that assigns numeric values to individual characters

• Characteristics of coding methods– All users must share same coding/decoding method

– Coded values must be capable of being stored or transmitted

– Specific method represents a tradeoff among compactness, ease of manipulation, accuracy, range, and standardization

Page 32: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

32Systems Architecture, Fifth Edition

Common Coding Methods

• EBCDIC (Extended Binary Coded Decimal Interchange Code)

• ASCII (American Standard Code for Information Interchange)– Subset of Unicode

– Device control

– Software and hardware support

Page 33: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

33Systems Architecture, Fifth Edition

Page 34: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

34Systems Architecture, Fifth Edition

(Partial listing)

Page 35: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

35Systems Architecture, Fifth Edition

ASCII Limitations

• Insufficient range– Uses 7-bit code, providing 128 table entries (33 for

device control)

– 95 printable characters can be represented

• English-based

Page 36: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

36Systems Architecture, Fifth Edition

Unicode

• Assigns nonnegative integers to represent individual printable characters (like ASCII)

• Larger coding table than ASCII– Uses 16-bit code providing 65,536 table entries

• Can represent written text from all modern languages

• Widely supported in modern software

Page 37: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

37Systems Architecture, Fifth Edition

Boolean Data

• Has only two data values—true and false• Potentially most concise coding format; only a

single bit is required

Page 38: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

38Systems Architecture, Fifth Edition

Memory Addresses

• Identifying numbers of memory bytes in primary storage

• Simple or complex numeric values depending on memory model used by CPU– Flat memory addresses (single integer)

– Segmented memory addresses (multiple integers)• Require definition of specific coding format

Page 39: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

39Systems Architecture, Fifth Edition

Data Structures

• Related groups of primitive data elements organized for a type of common processing

• Defined and manipulated within software• Commonly used data structures: arrays, linked

lists, records, tables, files, indices, and objects• Many use pointers to link primitive data

components

Page 40: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

40Systems Architecture, Fifth Edition

Page 41: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

41Systems Architecture, Fifth Edition

Pointers and Addresses

• Pointer– Data element that contains the address of another

data element

• Address– Location of a data element within a storage device

Page 42: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

42Systems Architecture, Fifth Edition

Arrays and Lists

• List– A set of related data values

• Array– An ordered list in which each element can be

referenced by an index to its position

Page 43: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

43Systems Architecture, Fifth Edition

Page 44: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

44Systems Architecture, Fifth Edition

Linked Lists

• Data structures that use pointers so list elements can be scattered among nonsequential storage locations– Singly linked lists

– Doubly linked lists

• Easier to expand or shrink than an array

Page 45: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

45Systems Architecture, Fifth Edition

Page 46: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

46Systems Architecture, Fifth Edition

Page 47: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

47Systems Architecture, Fifth Edition

Page 48: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

48Systems Architecture, Fifth Edition

Page 49: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

49Systems Architecture, Fifth Edition

Records and Files

• Records– Data structures composed of other data structures

or primitive data elements

– Used as a unit of input and output to files

• Files– Sequence of records on secondary storage

Page 50: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

50Systems Architecture, Fifth Edition

Page 51: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

51Systems Architecture, Fifth Edition

Methods of Organizing Files

• Sequential– Stores records in contiguous storage locations

• Indexed– An array of pointers to records

– Efficient record insertion, deletion, and retrieval

Page 52: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

52Systems Architecture, Fifth Edition

Page 53: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

53Systems Architecture, Fifth Edition

Classes and Objects

• Classes– Data structures that contain traditional data

elements and programs that manipulate that data

– Combine related data items and extend the record to include methods that manipulate the data items

• Objects– One instance, or variable, of the class

Page 54: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

54Systems Architecture, Fifth Edition

Page 55: 2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.

55Systems Architecture, Fifth Edition

Summary

• How data is represented and stored within computer hardware

• How simple data types are used as building blocks to create more complex data structures(e.g., arrays, records)

• Understanding data representation is key to understanding hardware and software technology