Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!umd5!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.wizards Subject: Re: Pagedaemon (4BSD) Message-ID: <9781@mimsy.UUCP> Date: 15 Dec 87 03:09:25 GMT References: <1381@saturn.ucsc.edu> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 38 Keywords: swapping 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