Quarterdeck Technical Note #226 Filename: BUFFERS.TEC
by Russell Bell CompuServe: BUFFER.TEC
Last revised: 2/07/92 Category: QEMM
Subject: Information on DOS's BUFFERS statement with respect to QEMM-386 and
QRAM. An explanation of how to load BUFFERS into High RAM.
The purpose of this document is to discuss the function of DOS BUFFERS,
how DOS allocates them, and how the Quarterdeck memory managers (QEMM-386 and
QEMM 50/60) and the memory enhancer, QRAM, deal with BUFFERS.
What is a BUFFER?
A BUFFER is a portion of memory that DOS sets aside for buffering disk
I/O. DOS stores directories and partial blocks here. DOS must read a full
sector of information from the disk. If the application asks for an amount of
information that is not an exact multiple of the sector size then the whole
sector must be stored somewhere while DOS gives the partial amount asked for
to the application that asked for it. DOS uses BUFFERS to store directories
because it needs somewhere to store information for its own use.
Where are the BUFFERS?
DOS keeps one BUFFER in the kernel to make sure that it has at least one
at all times. The rest are loaded as "Added Data" and may be seen on the
"DOS/Overview" page of MANIFEST.
How big are BUFFERS?
Each BUFFER takes 528 bytes unless you are using DOS version 2.x or 3.x
and you are using a third-party disk manager (like On-Track's "Disk Manager")
to create logical partition(s) larger than 32 MB. In this case, the size of
each BUFFER doubles (to 1056 bytes) for partitions between 33-64 MB, doubles
again (to 2112 bytes) for partitions between 65-128 MB, and again (to 4224
bytes) for partitions between 128-256 MB, and so on. This is because in these
versions of DOS the size of the BUFFER must follow the size of the sector; the
third-party disk partitioners double the size of the sector as needed. You
can see how big your BUFFERS by looking at the "DOS/Overview" page of MANIFEST
and seeing how much memory your BUFFERS take.
In DOS 4.x and 5.x the size of each BUFFER is fixed at 528 bytes.
How many BUFFERS do I need?
You only need one BUFFER. Any program that claims it needs more is
really only making a recommendation. Of course, your system will probably run
slower if you have only one BUFFER, but no more than one is actually needed to
operate. You should consult the DOS manual for suggestions about how many
BUFFERS you should have.
Disk caches may perform some of the same services that DOS BUFFERS
perform. If you use a disk cache you should consult the recommendation of the
authors of the disk cache when deciding how many BUFFERS to allocate.
BUFFERS is actually an area of ram which is available for buffering disk
I/O; they are not used by the count. If you want 20 BUFFERS, what you really
mean is that you want 10KB of disk buffering. If your BUFFERS are larger than
528 bytes (see paragraph above, "How big are BUFFERS") then you should
decrease the number of BUFFERS to get the same amount of buffering.
What do QEMM-386, QEMM 50/60, and QRAM allow me to do with BUFFERS?
QEMM-386, QEMM 50/60, and QRAM allow BUFFERS (with the exception of the
first BUFFER) to be moved to high RAM with DOS versions 2.x, 3.x, and 5.x.
Quarterdeck does this with a program called BUFFERS.COM, which loads BUFFERS
at the DOS prompt and can be loaded high with Quarterdeck's LOADHI.COM. See
the "The DOS Resources Programs" chapters in the QEMM -386, QEMM-50/60, or
QRAM manuals. Note that Quarterdeck's OPTIMIZE program will decrease the
BUFFERS=?? statement from your original CONFIG.SYS to BUFFERS=1 on DOS 2 and 3
systems because DOS will allocate more than one BUFFER by default when no
BUFFERS statement exists in the CONFIG.SYS.
What if I have DOS 4.x?
Microsoft changed the structure of BUFFERS in version 4.x of DOS. At the
same time Microsoft made it possible to move the BUFFERS into Expanded memory.
Since it is a more efficient use of memory to put BUFFERS into Expanded memory
than to load them high Quarterdeck did not change its BUFFERS.COM program to
accommodate DOS version 4.x. This feature of DOS is invoked with the "/x"
switch (BUFFERS=30/X, for example). Note that when BUFFERS are put into
Expanded memory they are allocated in multiples of 30, with a minimum of 30.
This is because Expanded memory can be used in increments of 16 kilobytes
only. 16 kilobytes can allocate 30 BUFFERS. If you use "BUFFERS=20/X" you
will get 30 BUFFERS; if you use "BUFFERS=40/X" you will get 60 BUFFERS.
The /X parameter has proved to cause problems with many programs and
users who have problems when they put the BUFFERS into expanded memory with
this switch should stop doing so.
Note that third party disk partitioners are not necessary with version
4.x of DOS and the size of each BUFFER does not change with the size of the
largest disk partition.
What if I have DOS 5.x?
Microsoft changed the structure of BUFFERS again with version 5. The
BUFFERS can no longer be loaded into expanded memory. If you use the DOS=HIGH
statement in the config.sys then the BUFFERS are loaded into the HMA along
with part of DOS's code. The BUFFERS cannot be broken up, part in the HMA,
part low. If you ask for more than will fit into the HMA all of them will
Beginning with version 6 of QEMM-386, version 6 of QEMM-50/60, and
version 2 of QRAM, BUFFERS.COM works with DOS 5.
BUFFERS in DOS 5 are "brittle": only those BUFFERS loaded into a single
contiguous piece of memory can be used. If you load BUFFERS into more than
one place, only the last BUFFERS are used, the previously loaded ones are
wasted. So if you load BUFFERS into the HMA (which happens with all BUFFERS
loaded in the config.sys when you use DOS=HIGH and there is room in the HMA
for all requested), then use BUFFERS.COM to load additional BUFFERS, the
BUFFERS in the HMA are not used.
48 BUFFERS can fit into the HMA with the DOS kernel when HIMEM.SYS is
used. When QEMM-386 is used, 51 BUFFERS can fit into the HMA with the DOS
kernel. Note that if you have some other HMA user loaded, in addition to the
DOS kernel, that there will not be room for this many BUFFERS. The Microsoft
Mouse Driver version 8.10 has the capability to load part of itself into the
HMA (only when DOS=HIGH is used), using about 13K of the HMA, displacing about
25 BUFFERS worth of room.
Third-party disk partitioners are not necessary to create partitions
larger than 32MB and the size of each BUFFER is constant in DOS 5.
What about Compaq DOS 3.31?
Compaq DOS 3.31, like DOS 4, allows partitions of the hard disk larger
than 32 MB without a third-party partitioning program and without increasing
the size of a BUFFER.
My system is running very slowly.
If your system seems to be running slowly after running Quarterdeck's
OPTIMIZE program, make sure that you have enough BUFFERS. You can see how many
you have by looking the "DOS/Overview" page of MANIFEST.
Quarterdeck tells me that I need to have version 2.x, 3.x, or 5.x of DOS in
order to load BUFFERS high.
This is indeed the case. See "What if I have DOS 4.x?" and "What if I
have DOS 5.x?"
I seem to be losing a lot of memory somewhere.
If you have DOS version 2.x or 3.x (but not Compaq DOS 3.31) and you are
using a third-party disk partitioning program then the size of the individual
BUFFER is increased to match the size of the sector. You may want to decrease
the number of BUFFERS you allocate. See the paragraphs "How big are BUFFERS?"
and "How many BUFFERS do I need?" above.
*This technical note may be copied and distributed freely as long as it*
*is distributed in its entirety and it is not distributed for profit. *
* Copyright (C) 1990-2 by Quarterdeck Office Systems *
************************ E N D O F F I L E *************************