Presentation is loading. Please wait.

Presentation is loading. Please wait.

Representing Data Elements By Ameya Sabnis CS 257 Section II Representing Block and Record Addresses.

Similar presentations


Presentation on theme: "Representing Data Elements By Ameya Sabnis CS 257 Section II Representing Block and Record Addresses."— Presentation transcript:

1 Representing Data Elements By Ameya Sabnis CS 257 Section II Representing Block and Record Addresses

2 Pointer Swizzling Generally pointers and addresses are the part of records Every block or record or object has two addresses 1. Database Address: When the data or object is in the secondary storage. These are of sequence of 8 bytes. 2. 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 Block 1 Block 2 Swizzled Read into Memory Unswizzled

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


Download ppt "Representing Data Elements By Ameya Sabnis CS 257 Section II Representing Block and Record Addresses."

Similar presentations


Ads by Google