Presentation is loading. Please wait.

Presentation is loading. Please wait.

13.6 Representing Block and Record Addresses Ramya Karri CS257 Section 2 ID: 206.

Similar presentations


Presentation on theme: "13.6 Representing Block and Record Addresses Ramya Karri CS257 Section 2 ID: 206."— Presentation transcript:

1 13.6 Representing Block and Record Addresses Ramya Karri CS257 Section 2 ID: 206

2 Introduction Address of a block and Record – In Main Memory virtual memory address of the first byte 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 in the overall system Sequence of Bytes describe the location of the block : the device Id for the disk, Cylinder number, etc.

3 Addresses in Client-Server Systems The addresses in address space are represented in two ways – Physical Addresses: byte strings that determine the place within the secondary storage system where the record can be found. – Logical Addresses: arbitrary string of bytes of some fixed length 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

4 Map Table relates logical addresses to physical addresses. LogicalPhysical Logical Address Physical Address A DDRESSES IN C LIENT -S ERVER S YSTEMS (C ONTD..)

5 Logical and Structured Addresses Purpose of logical address? Gives more flexibility, when we – Move the record around within the block – Move the record to another block Gives us an option of deciding what to do when a record is deleted? Recor d 4 Recor d 3 Recor d 2 Recor d 1 Header Offset table Unused

6 Pointer Swizzling Having pointers is common in an object- relational database systems Important to learn about the management of pointers Every data item (block, record, etc.) has two addresses: – database address: address on the disk – memory address, if the item is in virtual memory

7 Pointer Swizzling (Contd…) 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 DbaddrMem-addr Database address Memory Address

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

9 Pointer Swizzling (Contd…) Three 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.

10 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

11 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


Download ppt "13.6 Representing Block and Record Addresses Ramya Karri CS257 Section 2 ID: 206."

Similar presentations


Ads by Google