1 / 12

Representing Data Elements

Representing Data Elements. Representing Block and Record Addresses. By Ameya Sabnis CS 257 Section II. Pointer Swizzling. Generally pointers and addresses are the part of records Every block or record or object has two addresses

artie
Download Presentation

Representing Data Elements

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. Representing Data Elements Representing Block and Record Addresses By Ameya Sabnis CS 257 Section II

  2. Pointer Swizzling • Generally pointers and addresses are the part of records • Every block or record or object has two addresses • Database Address: When the data or object is in the secondary storage. These are of sequence of 8 bytes. • Memory Address: This is typically a virtual memory address. The address are typically of 4 bytes

  3. Pointer Swizzling A translation table is needed to translate all the database addresses in the virtual memory to their current memory address. The translation table can be shown as: Database address Memory Address Translation Table

  4. Pointer Swizzling • To avoid cost of translating from database address to memory address, several techniques are used collectively known as the Pointer Swizzling. • The general idea is when the block is moved from secondary to main memory the pointer is swizzed. • The pointer basically consists of a bit to show where the pointer currently is. • Consider the following example

  5. Disk Memory Read into Memory Swizzled Block 1 Unswizzled Block 2

  6. Types of Pointer Swizzling • Automatic Swizzling • Swizzling on demand • No Swizzling

  7. Automatic Swizzling • In this as soon as the block is moved to memory all its pointers and addresses are entered into translation table. • The translation table is created straightforwardly, as we know where in the memory the block is moved. • When we enter the database address in the translation table, we may find it in table because its block is in memory. Thus we replace the database address by corresponding address and set swizzled bit true

  8. Swizzling on Demand • Here all pointers are left unswizzled when the block is moved into memory. • We enter the address and the address of its pointer in the translation table along with its memory equivalent, only when we follow pointer P, inside the block memory. • Swizzling on demand tries to get all its pointers swizzled quickly and efficiently.

  9. No Swizzling • No pointers are swizzled in this case. • The translation table is created so that pointers will be followed in their unswizzled form. • The only advantage with this is the records cannot be pinned in memory.

  10. Returning Blocks to Disk • When a block is moved back from memory to disk all its pointers are unswizzled, also its memory addresses are replaced by database addresses. • Using the translation table it is possible to find out the database address corresponding to the memory address.

  11. Pinned Records and Blocks • A block is said to be pinned if it cannot be moved back to disk safely. • A block is pinned when it is pointed by some swizzled pointer externally. • It is necessary to unswizzled all the pointers which points to the pinned block. • The translation table must record, for each database address whose data item is in memory the places in memory where the swizzled pointers to that item exist.

  12. THANK YOU

More Related