TEXT   31

Disk Space manager

Guest on 22nd August 2022 01:39:54 PM

  1.  
  2. Disk Space manager
  3.  
  4. The disk space manager is the component of the system that takes care of the allocation and de-allocation of pages among the different files of a database. It also performs reads and writes of pages to and from disk. In Minibase, a database is implemented as a single UNIX file. It contains several DBMS level files, such as heap files, B+ tree files, etc.
  5.  
  6.  
  7.  
  8. The Database (DB) Class
  9. The DB class provides the abstraction of a single database stored on disk. It is the shields the rest of the database from the fact that the database is implemented as a single UNIX file. (Of course, the implementation of this layer suffers from the limitations of the UNIX file system!)
  10. Thre should be one instance of the DB class for every database used. (In Minibase, a transaction is allowed to have at most one active database, so there is just one instance of this class.) The operations on this class include creating and destroying databases. Existing databases can be opened and closed. Further, there are methods to retrieve certain characteristic properties of the database, like the number of pages and page size.
  11.  
  12. The DB class also provides a file naming service . This service is implemented using records consisting of file names and their header page ids. There are functions to insert/delete/access file entries.
  13.  
  14.  
  15.  
  16. The Page Class
  17. The abstraction of a page is provided by the Page class. All higher level applications use this Page. A Page contains an LSN and a data part. Higher layers can impose their own types of pages on this common structure.
  18.  
  19.  
  20. Space Management
  21. (Not relevant to the single-user version of Minibase.)
  22. This class is used to provide the shared memory state of the disk space manager. The idea was that if multiple databases were supported, then one manager could have several DB and DSM objects. Since this is not the case, the Space Manager class is awkward and can possibly be simplified. A database has a single space map that keeps track of the usage of the pages. The space manager maintains the space map in shared memory and ensures consistent access to it by different processes.
  23.  
  24. The space manager logs all changes to the space map and the directory of a database. The case of deallocation of pages is handled carefully to ensure that the effects of an aborting transaction can be completely undone. Deallocation requests by a transaction are not executed immediately. They are instead deffered and the page ids are maintained in a list. Only when the transaction commits, changes are made to the space map to reflect the deallocation.

Raw Paste


Login or Register to edit or fork this paste. It's free.