Professional Documents
Culture Documents
1. File Manager manages the allocation space on disk storage and the data structures
used to represent info stored on other media. In most applications (99.9%) the file is the
central element. All applications are designed with the specific goal: generation and use of
information. A typical file system layered architecture is the following (see also CPS510).
User Program
Sequential
Indexed
Random
Lists
Logical I/O
Basic File System Structure
Device Drivers (Disk,tape,etc)
Controllers
Actual Device
2. Buffer Manager among other tasks, it transfers blocks between disk (or other
3.
4.
5.
6.
devices) and Main Memory (MM). A DMA (Direct Memory Access) is a form of I/O that
controls the exchange of blocks between MM and a device. When a processor receives a
request for a transfer of a block, it sends it to the DMA which transfers the block
uninterrupted.
Query Parser translates statements in a query language, whether embedded or not,
into a lower level language. (See RL language example from CPS510). This parser is also a
strategy selector: i.e., finding the best and most efficient way (faster?) of executing the
query.
Authorization and Integrity Manager checks for the authority of the users to
access and modify info, as well as integrity constraints (keys, etc).
Recovery Manager ensures that the database is and remains in a consistent (sound)
state after any kind of failure.
Concurrency Controller enforces Mutual Exclusion by ensuring that concurrent
interactions with the data base proceed without conflict (deadlocks, etc).
Log
Scheduler
Recovery Manager
Concurrency Controller
Disk Storage:
Lock Table
B. Buffer management
Buffer Management (BM) is an essential part of DBMSs. This is a quite large area of
Main Memory that the OS allocates for the DBMS. All Transactions share this buffer
through common blocks. (Note: here blocks and pages are used interchangeably)
The blocks, same as pages in OS, fit exactly into the frames (located in Main Memory).
Since the buffer area is large, it means that it can "hold" a lot of blocks: the larger
the chunk of buffer, the more blocks it can hold, thus minimizing the transfer
between the disk and main memory, which is a slow process.
BM employs a directory or page tables which describe the current contents of the blocks
that are in the buffer: Physical file and corresponding block number. This is called
Locality or Localization in Software Engineering, (if there is such thing.., maybe the
most appropriate term should be Software Development). In this particular instance
localization of data. The Transaction does not have to wait for the appropriate block.
There is a rule of thumb, or a well known empirical law which says that only 20% of
data is being accessed by 80% of applications!
The Technique
While a Transaction is active, and during its life time Two Directories or Page Tables are
maintained:
1. The Current Page and
2. The Shadow Page.
The Shadow Page Table whose pages point to the Pages on Disk and the Current
Page Table also points to the Pages on Disk.
Before the start of the T both are identical. The Shadow table is never changed during
the execution of the T. Exactly like the parent in a fork in Unix. The Current page may
be changed when a write is performed - What transpires is that the system uses the
Current page to locate the pages on disk.
Example
Suppose that a T performs a write (X,x(i)) and that X is located in the ith page. We have
the execution:
1. The ith page where X is located is not already in MM. So, we issue an Input(X).
2. Output the Current page table to disk (Note: for recovery purposes we should not
overwrite the shadow table)
3. Output the disk address to the Current page table to disk: fixed location that
contains the address of the Shadow page table. This overwrites the address of the
old Shadow table. Therefore the Current Page becomes Shadow and T has
committed.
Recovery
It requires that we locate the Shadow page table AFTER the crash: the fixed location.
Then we copy that Shadow page table into MM and use it for the subsequent
Transaction processing.
Now the Shadow page table points to the pages that correspond to the state of the db
prior to any Transaction write.
Back track reading of the log. (vi editor in unix has this feature: using the -r and
also .rtf files in MSDOS?).
Disadvantages:
Note:
Executing the T commands mentioned above: fix, use, unfix, begin, commit, abort,
and flush, for the data base and the log. (Note: the flush belongs to the Buffer
Manager)
Executing primitives for recovery after failure: WARM Restart and COLD Restart.
(see below)
Reading and writing pages.
For Checkpoints
For Dumps. A complete copy of the db. A back up. At the conclusion of the dump
operation a dump record is written in the log, with time, filename and device.