Page 267 - DCAP403_Operating System
P. 267
Operating System
Notes FOE: “Fault on Execute”, Whenever an attempt to execute instructions in this page occurs, the
processor reports a page fault and passes control to the operating system,
FOW: “Fault on Write”, as above but page fault on an attempt to write to this page,
FOR: “Fault on Read”, as above but page fault on an attempt to read from this page,
ASM: Address Space Match. This is used when the operating system wishes to clear only some of
the entries from the Translation Buffer,
KRE: Code running in kernel mode can read this page,
URE: Code running in user mode can read this page,
GH: Granularity hint used when mapping an entire block with a single Translation Buffer entry
rather than many,
KWE: Code running in kernel mode can write to this page,
UWE: Code running in user mode can write to this page,
page frame number: For PTEs with the V bit set, this field contains the physical Page Frame
Number (page frame number) for this PTE. For invalid PTEs, if this field is not zero, it contains
information about where the page is in the swap fi le.
The following two bits are defined and used by Linux:
_PAGE_DIRTY: if set, the page needs to be written out to the swap fi le,
_PAGE_ACCESSED: Used by Linux to mark a page as having been accessed.
13.5.6 Caches
If you were to implement a system using the above theoretical model then it would work, but not
particularly efficiently. Both operating system and processor designers try hard to extract more
performance from the system. Apart from making the processors, memory and so on faster the
best approach is to maintain caches of useful information and data that make some operations
faster. Linux uses a number of memory management related caches:
Buffer Cache
The buffer cache contains data buffers that are used by the block device drivers.
These buffers are of fixed sizes (for example 512 bytes) and contain blocks of information that
have either been read from a block device or are being written to it. A block device is one that
can only be accessed by reading and writing fixed sized blocks of data. All hard disks are block
devices.
The buffer cache is indexed via the device identifier and the desired block number and is used to
quickly find a block of data. Block devices are only ever accessed via the buffer cache. If data can
be found in the buffer cache then it does not need to be read from the physical block device, for
example a hard disk, and access to it is much faster.
Page Cache
This is used to speed up access to images and data on disk.
It is used to cache the logical contents of a file a page at a time and is accessed via the fi le and
offset within the file. As pages are read into memory from disk, they are cached in the page
cache.
260 LOVELY PROFESSIONAL UNIVERSITY