1 / 41

Chapter 3 Data Representation

Chapter 3 Data Representation. Chapter 3 Data Representation. Chapter Outline Data Representation and Processing Automated Data Processing Binary Data Representation Goals of Computer Data Representation CPU Data Types Integer Real number Character Boolean Memory address

macree
Télécharger la présentation

Chapter 3 Data Representation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 3Data Representation

  2. Chapter 3Data Representation Chapter Outline Data Representation and Processing Automated Data Processing Binary Data Representation Goals of Computer Data Representation CPU Data Types • Integer • Real number • Character • Boolean • Memory address Technology Focus: Intel Memory Address Format Data Structures

  3. 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

  4. 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

  5. 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

  6. A + B = C Example Circuit

  7. 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

  8. 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

  9. Hexadecimal Notation

  10. 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

  11. Goals of Computer Data Representation Computer data formats are subject to trade-offs between several factors, including Compactness Accuracy Range Ease of manipulation Standardization Cost

  12. Goals of Data Representation Compactness (Size) Describes number of bits used to represent a numeric value Trade-off: hardware cost vs. range of values Fewer bits limits the range of values that can be represented More bits requires increased cost in computer hardware to represent numbers 216 = 65,53510 232 = 4,294,967,29610 264 = 18,446,744,073,709,551,61610

  13. Goals of Data Representation Accuracy (Precision) Precision of representation increases with number of data bits used Trade-off: hardware cost vs. precision Fewer bits limits the precision of values that are represented More bits requires increased cost in computer hardware to represent numbers precisely Calculations can easily produce numbers too big or too small to represent precisely So, they are represented as approximations that have a predictable error

  14. Goals of Data RepresentationEase of Manipulation Machine efficiency increases when processing shorter and simpler numeric formats Trade-off: processing time vs. precision Processor efficiency depends on its complexity Shorter and simpler formats require simpler circuitry More precise formats require increased cost in computer hardware to process instructions

  15. Goals of Data RepresentationStandardization Standardized data formats increases speed and accuracy of data communications Trade-off: processing time vs. networking The most efficient circuitry may require non-standard data formats To share information between a wide variety of devices, standardized data formats need to be used

  16. 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

  17. 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 • requires definition of specific coding format

  18. Intel Memory Address Formats • 8088 • 20-bit memory addresses • 4-bit segment identifier • 16-bit segment offset • 80286 • 24-bit memory addresses • 8-bit segment identifier • 16-bit segment offset • 80386 • 32-bit memory addresses • 16-bit segment identifier • 16-bit segment offset • 80486 • Pentium

  19. Data Structures • Related groups of primitive data elements organized for a type of common processing • Defined and manipulated within software • Many use pointers to link primitive data components

  20. Commonly Used Data Structures arrays linked lists records tables files indices objects

  21. One AddressFinds Many Data Elements

  22. Pointers and Addresses • Pointer • Data element that contains the address of another data element • Address • Location of a data element within a storage device

  23. 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

  24. A simple arrayis used to store words

  25. 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

  26. A SinglyLinked List

  27. A SinglyLinked List

  28. Editing An Array

  29. EditingA SinglyLinked List

  30. A DoublyLinked List

  31. 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

  32. A Record Data Structure

  33. Methods of Organizing Files • Sequential • Stores records in contiguous storage locations • Indexed • An array of pointers to records • Efficient record insertion, deletion, and retrieval

  34. An Indexed File

  35. 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

  36. A Classof Objects

  37. 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

  38. 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

More Related