Buffer / Media tool box

A forum for general AmigaOS 4.x support questions that are not platform-specific
Post Reply
Scriptjester
Beta Tester
Beta Tester
Posts: 73
Joined: Fri Feb 11, 2011 2:27 pm

Buffer / Media tool box

Post by Scriptjester »

In MediaToolBox, can we change the buffer for a disk without loosing any data ?
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: Buffer / Media tool box

Post by salass00 »

Scriptjester wrote:In MediaToolBox, can we change the buffer for a disk without loosing any data ?
If you mean the number of buffers setting then yes you should be able to change that without losing anything.
User avatar
Raziel
Posts: 1173
Joined: Sat Jun 18, 2011 4:00 pm
Location: a dying planet

Re: Buffer / Media tool box

Post by Raziel »

Scriptjester wrote:In MediaToolBox, can we change the buffer for a disk without loosing any data ?
Why not use C:Addbuffers?
Works with all connected drives (except cd/dvd/BD, i think)

from SYS:Documentation/C/Addbuffers.doc
Commands/ADDBUFFERS commands/ADDBUFFERS

NAME
ADDBUFFERS - Command the file system to add cache buffers.

FORMAT
ADDBUFFERS <drive> [<n>]

TEMPLATE
DRIVE/A,BUFFERS/N

PATH
C:ADDBUFFERS

FUNCTION
ADDBUFFERS adds <n> buffers to the list of buffers available for
<drive>. A buffer is a temporary storage area in memory. Allocating
additional buffers makes disk access significantly faster. However,
each additional buffer reduces free memory by approximately 500 bytes.
The default buffer allocation is 5 for floppy drives and usually 30 for
hard disks.

The number of buffers you should add depends on the amount of extra
memory available. There is no fixed upper limit, but adding too many
buffers can actually reduce overall system performance by taking RAM
away from other system functions.

If a negative number is specified, that many buffers are subtracted
from the current allocation. The minimum number of buffers is one;
however, using only one is not recommended.

Thirty buffers are generally recommended for a floppy drive in a
512K system. The optimal number for a hard disk depends on the type and
size of your drive. Normally you should use the default value
recommended by Media Toolbox. As a general rule, you can use 30 to 50
buffers for every megabyte of RAM in your system.

If only the <drive> argument is specified, ADDBUFFERS displays the
number of buffers currently allocated for that drive.

EXAMPLES
Add 25 buffers to drive DF1:.

1> ADDBUFFERS DF1: 25
DF1: has 30 buffers

Display the number of buffers currently allocated to drive DF0:.

1> ADDBUFFERS DF0:
DF0: has 20 buffers
Addendum:

While others have said 500 or more buffers for modern HDDs is the "standard" and will increase speed and decrease cache misses, i cannot second that.
My own tests showed that it doesn't matter if i use 200 or 2000 buffers on a partition when it comes to access speed and cache hits/misses.

I went back to using 200 on all my partitions (and yes i have both partitions with lots of small and some very big files, it doesn't matter)
People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1479
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: Buffer / Media tool box

Post by tonyw »

There are so many variables involved that it's probably not very useful to make a blanket statement like that. It (the performance increase with more buffers) depends on the size of the partition, the geometry (block size for a start) and lots of other things. The block size has more effect, in my experience.

The number of buffers is these days often ignored by modern filesystems. The filesystem makes its own decision and ignores other suggestions. In fact, the new vector-port filesystem API does not even have a command to change the number of buffers, so you are stuck with the number set in MTB.
cheers
tony
Post Reply