:PROPERTIES:
:ID: 6793b7a4-1791-480b-9163-0e72683bcc4a
:mtime: 20240525073702
:ctime: 20240525073701
:END:
#+title: buffer cache
#+filetags: :public:operatingsystems:project:
* Buffer Cache
Maintain copies of some parts of disk in memory for speed
** Reading then involves
- Locate relevant blocks from inode
- Check if in buffer cache
- If not, read from disk into buffer cache memory
- Return data from buffer cache
** Writing is the same except final step updates the version in the cache
- “Typically” prevents majority (around 85%) of implied disk transfers
- But at risk of losing data while the update is only in the buffer cache
** Must periodically flush dirty buffers to disk
- Can cache metadata too but what problems can that cause