Why page cache is required???
When a code is opened in text editor, data from the file is read into memory from disk. Later when you compile the file, the kernel can use the pages directly from the page cache.
The page cache is a cache of pages.
The pages in page cache can originate from read and write of regular file system files, block device files, and memory-mapped files.
Physical page size = 4KB
Physical block size = 512byte
Linux 2.2 – the page cache and the buffer cache
Linux 2.4 – the page cache
-> Clean page
-> Dirty page
-> Locked page
bdflush -> when memory is low (2.2)
kupdated -> called periodically (2.2)
pdflush -> dirty page flush (2.6)
pdflush daemon – "dirty page flush"
-> When free memory shrinks below a specified threshold, the kernel write dirty data back to disk.
-> When dirty data grows older than a specific threshold, old data is written back to disk. This happens periodically.
-> The different pdflush thread allows it to concentrate on different device queue.
-> The number of pdflush thread varies with a min of 2 and max of 8.
-> If all existing pdflush threads are busy for at least one second, a new pdflush thread is created
-> If pdflush thread sleep for more than asecond, it is terminated
Reference:
Linux Kernel Development - Robert Love