28.4. System daemonsA few system tasks, such as managing virtual memory and synchronizing the disk cache, are managed by daemons rather than by the kernel itself. The daemons that perform these functions cannot be manipulated by the system administrator and should generally be left alone. The paging daemonThe implementation of this daemon and its exact function vary widely across systems. It is named pageout on Solaris, vhand on HP-UX, kpiod under Red Hat, and pagedaemon under FreeBSD. This daemon is part of the virtual memory system. When a page of virtual memory is accessed, the system’s hardware consults a table to determine whether the page is currently in physical memory. If not, a fault occurs and the paging daemon is called to bring the page into memory from the swap area. If no physical pages are available, the paging daemon makes room by writing out some other page to the swap device and updating the appropriate page table entries.
See page 760 for more information about virtual memory. The swapping daemonThis daemon is called swapper on FreeBSD and HP-UX, and kswapd on Linux. When many processes are running simultaneously, the system begins to spend a lot of time processing page faults because each process has a certain number of pages that it accesses regularly. This condition is called thrashing, and it can seriously degrade performance. The swapping daemon monitors the number of page faults that occur in proportion to the number of memory references. If too many faults occur, the swapping daemon starts to move entire processes out to the swap space. Swapped processes are completely removed from physical memory and are prevented from running for a comparatively long time (seconds). The swapping daemon continues to eliminate processes until the page fault rate falls to an acceptable level. Swapping was designed for an era in which physical memory was very expensive, and the need for it in today’s computing landscape is questionable. Nevertheless, most systems still provide this capability. The filesystem synchronization daemonThe filesystem synchronization daemon executes the sync system call every 30 seconds. sync causes all “dirty” disk blocks to be written out, including filesystem superblocks, inode tables, and buffered data blocks.[4] This housekeeping minimizes the filesystem damage that can occur during a crash.
See page 133 for more information about filesystem superblocks. On most systems this daemon is called update, but HP-UX calls it syncer and Solaris calls it fsflush. |
|
来自: Stefen > 《Memory Management》