Presentation is loading. Please wait.

Presentation is loading. Please wait.

Representing Block and Record Addresses Rajhdeep Jandir ID: 103.

Similar presentations


Presentation on theme: "Representing Block and Record Addresses Rajhdeep Jandir ID: 103."— Presentation transcript:

1 Representing Block and Record Addresses Rajhdeep Jandir ID: 103

2 Agenda Background Background Client-Server Systems Client-Server Systems Logical and Structured Addresses Logical and Structured Addresses Pointer Swizzling Pointer Swizzling

3 Background Need to know about second storage address representation to see how the addresses, pointers, or references to records and blocks can be represented Need to know about second storage address representation to see how the addresses, pointers, or references to records and blocks can be represented In secondary storage: sequence of bytes describes the location of the block within the overall system of data accessible to the DBMS. In secondary storage: sequence of bytes describes the location of the block within the overall system of data accessible to the DBMS. Record can be found by giving its block and offset of the first byte of the record within the block. Record can be found by giving its block and offset of the first byte of the record within the block.

4 Client-Server Systems A db consists of server that provides data from secondary storage to client process A db consists of server that provides data from secondary storage to client process Client-Server process can be on one machine or on multiple machines Client-Server process can be on one machine or on multiple machines

5 Client-Server Systems Contd. Client applications use “virtual” address space: Client applications use “virtual” address space: Typically 32 bits or 4 billion different addresses Typically 32 bits or 4 billion different addresses OS or DBMS decides which parts of the address space are currently located in MM and hw maps VA space to physical location in MM OS or DBMS decides which parts of the address space are currently located in MM and hw maps VA space to physical location in MM For us think of client address space as MM For us think of client address space as MM

6 Client-Server Systems Contd. There are two ways that addresses of the server’s data can be represented: There are two ways that addresses of the server’s data can be represented: Physical Addresses Physical Addresses Logical Addresses Logical Addresses

7 Client-Server Systems Contd. Physical Address: Physical Address: Byte strings used to determine where the block or record is in the secondary storage Byte strings used to determine where the block or record is in the secondary storage One or more bytes of the string are used to indicate the following 6 things One or more bytes of the string are used to indicate the following 6 things

8 Client-Server Systems Contd. 1. The host to which the storage is attached to 2. An identifier to recognize which block is the data on 3. The cylinder number on the disk 4. The track number of the disk 5. The block number of the track 6. The offset of the beginning of the record within the block (some cases)

9 Client-Server Systems Contd. Logical Addresses: Logical Addresses: Each block/record has a “logical address” which is an arbitrary string of bytes of some fixed length. Each block/record has a “logical address” which is an arbitrary string of bytes of some fixed length. Map Table: Is in a disk in a known location Map Table: Is in a disk in a known location Map Table relates logical to physical addresses Map Table relates logical to physical addresses

10 Client-Server Systems Contd. Physical Addresses are long – 8 bytes minimum and can be as long as 16 bytes. Physical Addresses are long – 8 bytes minimum and can be as long as 16 bytes. Ex. A db lasts 100 years and may grow to have 1 mil. machines and each machine can create an object every ns. As a result the system creates around 2 27 objects. This requires a min. of 10 bytes but need more bytes to represent the host, storage unit,…etc. Ex. A db lasts 100 years and may grow to have 1 mil. machines and each machine can create an object every ns. As a result the system creates around 2 27 objects. This requires a min. of 10 bytes but need more bytes to represent the host, storage unit,…etc.

11 Logical and Structured Addresses Purposes of a logical address: Purposes of a logical address: By using a map table can easily move or delete the record to be changed By using a map table can easily move or delete the record to be changed Structured address schemes are possible through combo of logical and physical addresses Structured address schemes are possible through combo of logical and physical addresses Ex. Can use physical address for block and add key value for the record being referred to. To find the record, use physical address to get the block and find matching key Ex. Can use physical address for block and add key value for the record being referred to. To find the record, use physical address to get the block and find matching key

12 Logical and Structured Addresses Contd. Can also have each block have an offset table that holds the offsets of the records within the block. Can also have each block have an offset table that holds the offsets of the records within the block. Table grows from the front and records placed from the back – this way we don’t have to allocate a fixed amount of block header initially Table grows from the front and records placed from the back – this way we don’t have to allocate a fixed amount of block header initially

13 Logical and Structured Addresses Contd. record 1record 2 record 4record 3 header unused offset table

14 Logical and Structured Addresses Contd. Record address is now physical address of block plus offset entry in block’s offset table. Record address is now physical address of block plus offset entry in block’s offset table. The advantages: The advantages: Can move the record around the block easily Can move the record around the block easily Can move the record to another block if there is sufficient space Can move the record to another block if there is sufficient space A tombstone is made in the position where the record has been deleted so that when a pointer goes there it can be replaced by a null pointer A tombstone is made in the position where the record has been deleted so that when a pointer goes there it can be replaced by a null pointer

15 Pointer Swizzling Pointers/Addresses are for tuples that represent objects and not relations Pointers/Addresses are for tuples that represent objects and not relations OO db allows attributes of pointer type so that also needs to be represented OO db allows attributes of pointer type so that also needs to be represented Index structures are blocks which have pointers in them Index structures are blocks which have pointers in them

16 Pointer Swizzling Contd. Definitions: Definitions: Database Address: the data that is in the secondary storage for the server’s db to access Database Address: the data that is in the secondary storage for the server’s db to access Memory Address: address in virtual memory Memory Address: address in virtual memory Efficient to use MA when item has a pointer Efficient to use MA when item has a pointer DA time-consuming – need a translation table DA time-consuming – need a translation table

17 Pointer Swizzling Contd. database address memory address DAMA Translation Table:

18 Pointer Swizzling Contd. Note: Note: Logical and physical address represented in DA. MA in TT is for copies of corresponding object in memory Logical and physical address represented in DA. MA in TT is for copies of corresponding object in memory All addressable items in db have entries in map table vs only items in memory are in TT All addressable items in db have entries in map table vs only items in memory are in TT

19 Pointer Swizzling Contd. Pointer swizzling is a technique to avoid repeated translation from DA to MA Pointer swizzling is a technique to avoid repeated translation from DA to MA Move a block from MM pointers from block may be “swizzled” – translated from DA space to VA space Move a block from MM pointers from block may be “swizzled” – translated from DA space to VA space Pointer has: Pointer has: Bit: indicates if DA or SMA (swizzled memory address) Bit: indicates if DA or SMA (swizzled memory address) Database or memory pointer Database or memory pointer


Download ppt "Representing Block and Record Addresses Rajhdeep Jandir ID: 103."

Similar presentations


Ads by Google