rwwetmore@watmath.waterloo.edu (Ross Wetmore) (03/21/88)
In article <352@mancol.UUCP> samperi@mancol.UUCP (Dominick Samperi) writes: > UID PID PPID C STIME TTY TIME COMMAND > root 0 0 40 02:48:46 ? 300:59 swapper > root 1 0 0 02:48:46 ? 0:25 [ init ] > root 0 0 0 02:48:46 ? 0:55 swapper Something I always puzzled over was why there were always 2 swapper processes listed by ps, and why one is normally not used. Since this is apparently not a local phenomenon, maybe someone can shed light on this piece of trivia? Ross W. Wetmore | rwwetmore@water.NetNorth University of Waterloo | rwwetmore@math.waterloo.edu Waterloo, Ontario N2L 3G1 | {clyde, ihnp4, ubc-vision, utcsri} (519) 885-1211 ext 3491 | !watmath!rwwetmore
jfh@rpp386.UUCP (John F. Haugh II) (04/05/88)
In article <17656@watmath.waterloo.edu> rwwetmore@watmath.waterloo.edu (Ross Wetmore) writes: >In article <352@mancol.UUCP> samperi@mancol.UUCP (Dominick Samperi) writes: >> UID PID PPID C STIME TTY TIME COMMAND >> root 0 0 40 02:48:46 ? 300:59 swapper >> root 1 0 0 02:48:46 ? 0:25 [ init ] >> root 0 0 0 02:48:46 ? 0:55 swapper > > Something I always puzzled over was why there were always 2 swapper >processes listed by ps, and why one is normally not used. Since this is >apparently not a local phenomenon, maybe someone can shed light on this >piece of trivia? the first swapper runs when the operating system is idle. if the clock interupt catches the swapper looping in an idle state, the swapper gets billed for that one tick. so far as i know, this has been true since system iii days. i don't believe is was the case in version 7. to test this, next time you single user your system, do this. # ps -fp 0 ; sleep 60 ; ps -fp 0 while yield a one minute change in the swapper's cpu time. the second `swapper' has more to do with swapping and is only run when pages are swapped in (or is it out?). the `swapper' message is produced by ps, rather than getting the command name from u_comm, which is the standard idiom (or else searching for it on the process stack). if p_flag & SSYS is true, then ps names the process `swapper' i believe the pid is zero to keep kill from getting more complex. rather than having to make an exception for pid = 2, someone decided both scheduling processes would be pid = 0. - john. -- John F. Haugh II, in the bedroom. | +----------+ UUCP: ...!ihnp4!ninja!rpp386!jfh | | SPACE | DOMAIN: jfh@rpp386 | | FOR RENT | DATA: +1 214 250-6272, login: anonuucp | +----------+