1 / 15

13.6 Representing Block and Record Addresses

13.6 Representing Block and Record Addresses. Deepika Verma CS257 Section 1 ID: 106. Outline. 13.6.1 Addresses in Client-Server Systems 13.6.2 Logical and Structured Addresses 13.6.3 Pointer Swizzling 13.6.4 Returning Blocks to Disk 13.6.5 Pinned Records and Blocks

mauli
Télécharger la présentation

13.6 Representing Block and Record Addresses

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. 13.6 Representing Block and Record Addresses Deepika Verma CS257 Section 1 ID: 106

  2. Outline 13.6.1 Addresses in Client-Server Systems 13.6.2 Logical and Structured Addresses 13.6.3 Pointer Swizzling 13.6.4 Returning Blocks to Disk 13.6.5 Pinned Records and Blocks 13.6.6 Exercises for Section 13.6

  3. Introduction • Address of a block and Record • In Main Memory • Address of the block is the virtual memory address of the first byte • Address of the record within the block is the virtual memory address of the first byte of the record • In Secondary Memory • Sequence of Bytes describe the location of the block : the device Id for the disk, Cylinder number, etc.

  4. 13.6.1 Addresses in Client-Server Systems • Physical Addresses: • Byte strings referring to the place within the secondary storage system where the record can be found. • Physical Address bits are used to indicate: • Host to which the storage is attached • Identifier for the disk • Number of the cylinder • Number of the track • Offset of the beginning of the record • Logical Addresses: • arbitrary string of bytes of some fixed length that maps to physical address

  5. Map Table Logical Address Physical Address Stored on disk in a known location, relates logical addresses to physical addresses.

  6. 13.6.2 Logical and Structured Addresses Unused Offset table Header • Purpose of logical address: • Gives more flexibility, when we • Move the record around within the block • Move the record to another block • Easy updating of records • Structured address • Gives us an option of deciding what to do when a record is deleted

  7. 13.6.3 Pointer Swizzling • Having pointers is common in an object-relational database systems • Every data item (block, record, etc.) has two addresses: • database address: address on the disk • memory address, if the item is in virtual memory • When block is moved from secondary storage to main memory pointers within block are “swizzled”,i.e translated from database address space (Server) to virtual address space (Client)

  8. Pointer Swizzling (Contd…) Database address Memory Address Translation Table: Maps database address to memory address All addressable items in the database have entries in the map table, while only those items currently in memory are mentioned in the translation table

  9. Pointer Swizzling (Contd…) Disk Memory Swizzled Block 1 Block 1 Unswizzled • Pointer consists of the following two fields • Bit indicating the type of address • Database or memory address • Example 13.17 Block 2

  10. Example 13.7 • Block 1 has a record with pointers to a second record on the same block and to a record on another block • If Block 1 is copied to the memory • The first pointer which points within Block 1 can be swizzled so it points directly to the memory address of the target record • Since Block 2 is not in memory, we cannot swizzle the second pointer

  11. Types of Swizzling • Automatic Swizzling • As soon as block is brought into memory, swizzle all relevant pointers. • Swizzling on Demand • Only swizzle a pointer if and when it is actually followed. • No Swizzling • Pointers are not swizzled they are accesses using the database address.

  12. Programmer Control of Swizzling • Unswizzling • When a block is moved from memory back to disk, all pointers must go back to database (disk) addresses • Use translation table again • Important to have an efficient data structure for the translation table

  13. 13.6.4 Returning Blocks to Disk When a block is moved from memory back to disk, any pointers within that block must be unswizzled, i.e. memory address must be replaced by database address.

  14. 13.6.5 Pinned records and Blocks • A block in memory is said to be pinned if it cannot be written back to disk safely • If block B1 has swizzled pointer to an item in block B2, then B2 is pinned • Unpin a block, we must unswizzle any pointers to it • Keep in the translation table the places in memory holding swizzled pointers to that item • Unswizzle those pointers (use translation table to replace the memory addresses with database (disk) addresses

  15. Thank You

More Related