4.3 Shared Memory Structure
Next: 4.4 The Log Manager
Up: 4 Log Manager Interface
Previous: 4.2 Log records
The Minirel system consists of several processes, each trying to
access and update a single database. Thus, some form of sharing is
required between processes to access common data structures. One
example of a shared data structure is the log tail. This section
describes the data structure maintained by the log manager in shared
memory.
The data structure maintained in shared memory is an object of
class shm_log (header file: logshm.h). It contains the
following fields:
- The log tail. This is used to write log records into
the log. When the log tail is full, it is flushed to disk.
- The first LSN. This is the LSN of the earliest log
record that the recovery subsystem is interested in. Log records with
LSNs before this will never be used for a future restart.
- The next LSN. This is the LSN
that will be assigned to the next log record that is written.
- The log file header. This contains the master log
record, the maximum size of the log (in pages), and the log tail size
(in pages). Currently, the log tail size is fixed at 1 page.
- The number of transactions that are currently sharing
this shared memory structure.
- A semaphore to mutually exclude log opens from one
another.
Only class log accesses the shared memory structure. However,
its definition must be made public so that the OS infrastructure group
can declare a shared memory segment of suitable size and assign the
global pointer global_shm_log_ptr to the correct address.
ajitk@cs.wisc.edu, cjin@cs.wisc.edu