ptg10805159
Section 20.5 Centralized or Decentralized? 751
We purposely show the IPC going through the kernel, as most forms of message
passing under the UNIX System operate this way.(Shared memory, as described in
Section 15.9, avoids this copying of the data.)With the centralized approach, a recordis
read by the central process and then passed to the requesting process using IPC. This is
adisadvantage of this design. Note that the centralized database manager is the only
process that does I/O with the database files.
The centralized approach has the advantage that customer tuning of its operation
may be possible. For example, we might be able to assign different priorities to
different processes through the centralized process. This could affect the scheduling of
I/O operations by the centralized process. With the decentralized approach, this is
moredifficult to do. We are usually at the mercy of the kernel’s disk I/O scheduling
policy and locking policy; that is, if three processes arewaiting for a lock to become
available, we cannot tell which process gets the lock next.
Another advantage of the centralized approach is that recovery is easier than with
the decentralized approach. All the state information is in one place in the centralized
approach, so if the database processes arekilled, we have only one place to look to
identify the outstanding transactions we need to resolve to restorethe database to a
consistent state.
The decentralized approach is shown in Figure20.5. This is the design that we’ll
implement in this chapter.
recordlocking I/O kernel
index file data file
db access
library
user process
db access
library
user process
Figure 20.5Decentralized approach for database access