Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Oct 1996 12:00:00 +0900 (KST)
From:      Heo Sung-Gwan <heo@cslsun10.sogang.ac.kr>
To:        freebsd-fs@FreeBSD.ORG
Subject:   nbuf in buffer cache
Message-ID:  <Pine.SUN.3.93.961002115902.4123A-100000@cslsun10>

next in thread | raw e-mail | index | archive | help
Hi,

I am curious about the number of buffers(= nbuf) in buffer cache.
The variable nbuf is determined in i386/i386/machdep.c as following: 

 #ifdef	NBUF
 int	nbuf = NBUF;
 #else	
 int	nbuf = 0;
 #endif
 ...

 void
 cpu_startup()
 {
	...
	if (nbuf == 0) {
		nbuf = 30;
		if( physmem > 1024)
			nbuf += min((physmem - 1024) / 12, 1024);
	}
	...
 }

If NBUF is not defined and physical memory is less than 1024 pages(= 4Mbytes) 
then nbuf becomes 30, and otherwise nbuf is 30 + min((physmem - 1024) / 12, 
1024).

Why does the number of buffers is calculated in this fashion? 
30 buffers, 1024 pages, and division by 12 have special meaning? 
There is no comment on source code.

In addition, if there is no user application processes how many buffers 
are enough to run the system without degrading the performance of the system? 
Only 30 buffers? Or better as many as possible?

Please let me know. 

--
Heo Sung-Gwan
Dept. of Computer Science, Sogang University, Seoul, Korea.
E-mail: heo@cslsun10.sogang.ac.kr






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SUN.3.93.961002115902.4123A-100000>