Date: Sun, 30 Nov 2003 03:04:41 -0800 From: David Schultz <das@FreeBSD.ORG> To: Jay Sern Liew <jay.liew@ml.freebsd.jaysern.org> Cc: freebsd-threads@FreeBSD.ORG Subject: Re: thread/process & memory management source code Message-ID: <20031130110441.GA34017@VARK.homeunix.com> In-Reply-To: <20031129183810.M90959@pinnacle.schulte.org> References: <20031129183810.M90959@pinnacle.schulte.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[Redirected to threads@; please avoid spamming multiple lists.] On Sat, Nov 29, 2003, Jay Sern Liew wrote: > Can someone point to me the specific location in the FreeBSD kernel source > where the code for FreeBSD's thread/process & memory management are? > > Specifically, where the dispatcher and scheduler is implemented, > what kind of scheduling algorithms(short term, long term) are used, > where the dynamic storage allocation algorithm is implemented(I'll try > to figure the algorithm used from the code), etc. For short term scheduling, FreeBSD uses the standard Unix decay-usage priority scheduling. There is also an experimental scheduler called ULE, which is designed to work better on SMPs. ULE uses an ad hoc idea about how ``interactive'' a process is in order to make scheduling decisions. See kern_switch.c, sched_4bsd.c, sched_ule.c in src/sys/kern. Long term scheduling is less important than it used to be, but FreeBSD has a swapout daemon that kicks in when the system can't recover enough memory by paging alone. It will basically swap out every process it can that is idle and hasn't already been swapped out recently. Swapping in occurs according in the order of a priority that is based on the interactivity of the process, the time it has been swapped out, and its nice value. See src/sys/vm/vm_glue.c. The primary kernel memory allocator is a slab allocator. See src/sys/vm/uma_*.c, src/sys/kern/kern_malloc.c, and http://citeseer.nj.nec.com/bonwick94slab.html.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031130110441.GA34017>