koreth@ssyx.ucsc.edu (Steven Grimm) (12/11/87)
This is probably a very simple question, but our resident UNIX guru couldn't come up with an answer. It has to do with the "pagedaemon" process. I was doing a ps -aux one day and noticed that although our pagedaemon's total process size is 512K, none of it is resident in main memory. Am I mistaken in assuming that the page daemon is what handles page swapping? If so, how on Earth does it ever get swapped in from disk to swap things in from disk? That seems like an awfully strange setup to me. Any answers would be greatly appreciated. +New! Improved! Now 100% Artificial-+-+-----------------------------------+ |# # @@@ **** &&&&& $$$$$ % %| |Steven Grimm | |# # @ @ * * & $ % %+-+ ARPA: koreth@ucscb.ucsc.edu | |### @ @ **** &&&& $ %%%%%| | UUCP: ...!ucbvax!ucscc!ssyx!koreth| |# # @ @ * * & $ % %+-+ ______________________________| |# # @@@ * ** &&&&& $ % %| | |"Let's see what's out there."| +-----with NutraSour(TM)! No natural colors or preservatives!------------+
chris@mimsy.UUCP (Chris Torek) (12/15/87)
In article <1381@saturn.ucsc.edu> koreth@ssyx.ucsc.edu (Steven Grimm) writes: >... I was doing a ps -aux one day and noticed that although our >pagedaemon's total process size is 512K, none of it is resident >in main memory. Am I mistaken in assuming that the page daemon >is what handles page swapping? The page(out) daemon handles dirty page pushes: That is, given that the machine is low on memory, the page daemon scans memory looking for pages that can be reused. Some of them can be reused only after being written to a backing store. This write cannot be done directly by the process being paged out, nor can it be done without being done by some process. Hence such writes are performed by the page daemon. As for its size, this is in fact a lie. The pageout daemon is large enough to map all the possible transfers that it might be doing at one time. The executable code for this process is all contained in the kernel, and is never swapped. >If so, how on Earth does it ever get swapped in from disk to >swap things in from disk? The pager and the swapper are quite separate (an arrangement that has always seemed odd to me: after all, a full swapout is just a pageout that takes all of the process' pages). In addition, pageins are done synchronously by the process that referenced the page. The trick is that all I/O has to be owned by some process, and that process is normally suspended during that I/O; for a pagein, the process is not doing anything interesting anyway, since it needs one of those pages first. Pageouts, however, are done behind a process' back, so must be charged to the page daemon. Some ugly code special-cases page daemon writes so that the page daemon is not suspended during the transfer; in exchange, the page daemon is careful not to fiddle with the PTEs that describe that transfer until it is finished. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris