Mac OS X uses a boot-time optimization (effectively a smart read-ahead) that monitors the
pattern of incoming read requests to a block device (the boot disk), and sorts the pattern into a
"playlist", which is used to cluster reads into a private cache.
This "boot cache" is
then used for satisfying incoming read requests, if possible. The scheme also measures the cache hit rate,
and stores the request pattern into a "history list" for being adaptive in future.
If the hit rate is too low, the caching is disabled.
The loadable (sorted) read pattern is stored in
Once this pattern is loaded, the cache comes into effect. The entire process is invisible from users.
System/Library/Extensions/BootCache.kext is the location of the kernel extension implementing the cache
Contents/Resources/BootCacheControl within that directory is the user-level control utility (it lets you load the playlist, among other things).
BootCache is started (via
and a prefetch tag is inserted (unless the system is booting in safe mode (
/etc/rc looks for
BootCacheControl in the
directory of the BootCache.kext bundle, as well as in
/usr/sbin/BootCacheControl directly, and does not find it.
Making BootCacheControl available in
/usr/sbin, via a symbolic link, reduces the boot time .
/private/var/db/BootCache.playlist was 47,484 bytes on 9/26/08.
[‑f playlistfile ] start|stop
Start/stop the cache using |
| displays |
/var/dc/statistics for the currently-active cache.
> sudo bootcachecontrol statistics print
initiated reads 3758
blocks read 306012
read errors 0; blocks discarded by error 0
batch 0 time 4.342s; batch 1 time 17.093s; batch 2 time 18.078s
blocks read in batch 0: 62033; blocks read in batch 1: 143238; blocks read in batch 2: 100741
reader thread rate 3872kB/s, 95tps
total strategy calls 8691
non-read strategy calls 1238 bypassed strategy calls 2818
bypasses while active 1623
filled strategy calls 5873
filled during active I/O 5290
active time 58.411s
read/write strategy rate 127/21tps
callers blocked 39
time blocked on extents 88.770s
extents in cache 1978 extent lookups 7453 extent hits 6824
extent hit ratio 91.56%
hits not fulfilled 951
blocks requested 347066
blocks hit 299266
blocks discarded by write 112
block hit ratio 86.26%
leftover blocks 6522
leftover pages 0
block wastage 2.13%
history clusters 14
|Insert the end-prefetch tag.
[-vvv] -f playlistfile
merge playlistfile1 [playlistfile2 … ]|
[-c] -f playlistfile
| output the contents of |
-f playlistfile unprint
| Read a playlist from STDIN and write to |
-f playlistfile generate [volume]
Generate a playlist from standard input data for |
volume and write to
-f playlistfile truncate count
| Truncate |
/private/var/db/bootCache has been known to fix kernel trap
Only supported on the root device, requires at least 128 MB of physical RAM before it is enabled (automatically).