ptg10805159786 ADatabase Library Chapter 20Figure20.9 is a graph of the data from Figure20.8 for advisory fine-grained locking.
We plot the clock time as the number of processes goes from 1 to 16. We also plot the
user CPU time divided by the number of processes and the system CPU time divided
by the number of processes.#processesclock time
(seconds)sys CPU/#proc,
user CPU/#proc
(seconds)(^12345678910111213141516)
0
10
20
30
40
50
60
70
80
0
2
4
6
8
- ∗
Δ- ∗
Δ- ∗
Δ∗Δ- ∗
Δ- ∗
Δ- ∗
Δ- ∗
Δ- ∗
Δ- ∗
Δ∗Δ∗Δ∗Δ∗Δ∗Δ∗Δuser CPU/#procsystem CPU/#procclock timeFigure 20.9 Values from Figure20.8 for advisory fine-grained lockingNote that both CPU times, divided by the number of processes, arelinear but that the
plot of the clock time is nonlinear.The probable reason is the added amount of CPU
time used by the operating system to switch between processes as the number of
processes increases. This operating system overhead would show up as an increased
clock time, but shouldn’t affect the CPU times of the individual processes.
The reason the user CPU time increases with the number of processes is that there
aremorerecords in the database. Each hash chain is getting longer, so it takes the
_db_find_and_lockfunction longer, on average, to find a record.20.10 Summary
This chapter has taken a long look at the design and implementation of a database
library.Although we’ve kept the library small and simple for presentation purposes, it
contains the recordlocking required to allow concurrent access by multiple processes.
We’ve also looked at the performance of this library with various numbers of
processes using no locking, advisory locking (fine-grained and coarse-grained), and
mandatory locking. With a single process, we saw that advisory locking adds between