From owner-freebsd-hackers Mon Sep 30 05:05:53 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id FAA18846 for hackers-outgoing; Mon, 30 Sep 1996 05:05:53 -0700 (PDT) Received: from ccs.sogang.ac.kr (ccs.sogang.ac.kr [163.239.1.1]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id FAA18791 for ; Mon, 30 Sep 1996 05:05:49 -0700 (PDT) Received: from cslsun10.sogang.ac.kr by ccs.sogang.ac.kr (8.8.0/Sogang) id VAA07485; Mon, 30 Sep 1996 21:01:25 +0900 (KST) Received: from localhost by cslsun10.sogang.ac.kr (4.1/SMI-4.1) id AA02138; Mon, 30 Sep 96 21:04:28 KST Date: Mon, 30 Sep 1996 21:04:27 +0900 (KST) From: Heo Sung-Gwan X-Sender: heo@cslsun10 To: freebsd-hackers@FreeBSD.ORG Subject: nbuf in buffer cache Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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