Presentation is loading. Please wait.

Presentation is loading. Please wait.

Representing Block & Record Addresses

Similar presentations


Presentation on theme: "Representing Block & Record Addresses"— Presentation transcript:

1 Representing Block & Record Addresses

2 Outline Types of Addresses Pointer Swizzling Returning Blocks to Disk
Automatic swizzling Swizzling on demand No swizzling Programmer control of swizzling Returning Blocks to Disk Pinned Records and Blocks

3 Types of Addresses What is address? continued..
Commonly, database system consists of Client – Server architecture Client application uses virtual address space Server uses database address space, referred to as blocks continued..

4 Types of Addresses Physical Address Logical Address
Byte strings referring to the place within secondary storage where data(record) is saved Logical Address Arbitrary string of bytes of some fixed length that maps to physical address continued..

5 Types of Addresses Physical Address Host name: My PC
Disk name:Megatron747 Cylinder # 10 (total #216 ) Track (Surface) # 3 (total # 24) (within cylinder) (A sector has total # of 212 bytes. Block # 2 (total # 4 sectors) (total # 28 sectors per track (average) ) ) Offset of the beginning record at10th byte

6 Types of Addresses Physical Properties Rotation 11 miliseconds
Acceleration of disk arms is about 5Gravational force Start and stop need 1 milisecond

7 Types of Addresses Disk name:Megatron747
Compute the bytes in the following devices Cylinder Track Block

8 Map Table

9 More on Logical Address
Purpose Easy updating of records Structured address

10 Pointer Swizzling As discussed earlier, every record in memory has two forms of addresses We can use either to access record 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) Consists of a bit indicating if pointer is currently a database address or memory address The database or memory pointer itself

11 1 Pointer Swizzling

12 Types of Swizzling Automatic Swizzling Swizzling on Demand
Whenever a block is moved to main memory swizzle all its pointers Swizzling on Demand Leave all pointers unswizzled when block is first loaded into memory, swizzle the pointer only if we need to follow it Programmer Control of Swizzling No Swizzling Never swizzle the pointers. Advantage is there is no need to load record in main memory

13 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 Pinned Records and Blocks
‘Pinned’ means if the block cannot be written back to disk safely Indicated by a bit located in the header of the block To write a pinned block back to disk we need to ‘unpin’ the block Unswizzle any pointers associated to it


Download ppt "Representing Block & Record Addresses"

Similar presentations


Ads by Google