This article is an attempt to provide answers to questions about how to create an optimal system from existing software and hardware components. It's about the performance of the disk complex - how to connect hard drives and CD / DVD drives, IDE controller drivers, where to place the virtual memory file and what size to allocate for it, and many other performance issues.

The material in this article is quite universal, since most of the problems discussed concern either hardware or general principles of building modern operating systems. Nevertheless, where I can do this, I will try to give concrete advice on changing the settings of specific systems.

IDE interface

Hardware Device Connection

The vast majority of modern computers have a disk system based on the IDE interface (ATAPI). Traditional motherboard has two channels of IDE controller - primary and secondary, each of which is, in fact, a separate controller. Each channel has its own connector on the motherboard and a separate loop, to which one or two IDE devices can be connected. One of them will work in master mode and the other in slave mode, and these modes are set by jumpers on the drive or drive. I will not reveal any new facts - everything I say in this section has already been said in various documents and FAQs. Despite this, the question of what to connect and where to find is often enough, and since this directly affects the work of the disk system, I will try to put together everything that can be said on this topic.

At once I will add that it is not possible to describe the speed of SCSI-based systems in this article, mainly because of the immensity of this topic and the presence of a huge number of particulars.

How do two devices work on one channel (loop)?

Unfortunately, the existing protocol of working with IDE devices does not allow two drives working on one channel to work completely separately from each other. It's not even that they use a common cable (cable) to connect to the controller. The problem is somewhat more acute - the data transfer protocol itself (the controller device) and the driver mode used in the overwhelming number of IDE systems, does not allow one of the devices to be used until another device has performed the command given to it. In practice, this translates into a very unpleasant thing: for example, the hard drive received a command to count the sector. Often, he can not do this at once - for example, because the hard disk heads are in a different area, and to read the sector will have to perform mechanical operations. While searching for the required data - about ten milliseconds - the device simply keeps silent, executing the command of the controller. Unfortunately, during this period the second IDE device located on the same controller (channel) is simply not available. The problem of two hard disks located on the same IDE controller is not so bad, because the hard disk is in any case capable of executing commands to it quickly enough. In the case, for example, with a CD-ROM drive, the problem can get much more serious. When the CD-ROM searches for a track (on the order of hundreds of milliseconds, in rare cases - and more), performs some of its own, for example calibration, manipulations, or even just has difficulty reading the sector (up to ten (!) Seconds), the second device , Working on the same channel, is simply not available.

The conclusion, unfortunately, has to do this: if possible, place the devices with which simultaneous operation will be performed on different controllers. If you only have two devices - you just put them on different controllers, and each of them will work separately from the other, and, therefore, in an optimal way. And if there are more devices?

  • Two hard drives and a CD / DVD-ROM? Most likely, it makes sense to leave one - the main, system, hard drive alone, so that nothing could interfere with access to system files and virtual memory. And if you want to put some of the programs or a virtual memory file on another hard drive? In this case, you will still be better to carry these hard drives to different controllers to ensure their simultaneous operation. On the other hand, if you often use CD / DVD - for example, you often listen to music (MP3), then maybe it makes sense to put the reading drive on a separate controller - in this case, the difficulty of reading data from the CD will not interfere with your background work and Do not freeze the main hard drives, and hence the entire computer.

  • Writing drive (CD-R / -RW / DVD-ROM)? Think about what media you will be recording on this drive. If, for example, you often rewrite disks "on the fly" (from a normal CD-ROM to CD-R), then it is highly desirable for you to spread the CD-ROM and the CD-R drive across different controllers. If your drive has a large enough buffer, it's not very important, but if your write-in drive's buffer is small, it would be extremely good to place it on a separate controller alone. Or not alone (if this is not possible), but at least paired with a device that will not be used in the process of burning discs-for example, you can put it together with a hard drive that stores data not related to the recording process.

To the question of how to place several hard disks to create an optimal system for speed, and what benefits can be obtained from several hard disks, we'll come back.

Slave or master?

Two devices located on one loop, in one way or another cooperate to ensure their work. Each IDE device has a slave or master switch, and two devices running on the same loop should work in different modes. Does it matter which of the devices will be slave, and what is the master? Now it is possible to say quite confidently: it does not matter. The work of the IDE protocol in the form to which it came to the present time, practically does not depend on which of the devices is a slave, and which is a master. Set jumpers as it would be logical from the operating system's point of view (by default, in most systems letters are assigned to disks in the order in which they are physically present in the system-that is, first the master will go, then the slave first). The only thing you can still say about the hardware aspect - if you have a very old hard disk or CD-ROM (say, more than five years ago), try not to put it as a master to a more modern device. This is unlikely to bring a performance penalty, but can give rise to fundamental compatibility issues, because of which the second device (slave), or even both drives, will not work correctly or will not work at all. One more note - if there are two drives on one controller that can read a CD, then it will not work from the second (slave) drive. The last problem has already been solved in the latest motherboards (in the BIOS AWARD 6.0, for example, you can choose which device will be considered a CD-drive when choosing the boot sequence), but so far, such boards are far from the majority. If you have two CDs on one controller (for example, CD and CD-RW), and you want to be able to boot from a CD drive, it is advisable to set it as master - this will work regardless of the board and BIOS version.

Which device to connect to the middle connector of the loop, and which - to the extreme?

This is also not critical. Yes, some electromagnetic moments make this or that combination the preferred one, but in practice the other aspect is much more important: simply connect the devices so that the cable passes as freely as possible, does not bend or stretch. Excessive mechanical deformations and voltage of the loop can lead to the fact that in some place (for example, in the connector) you will get weak contact or (partial) damage to the wires of the loop itself, and this can lead to loss of data or unreliable operation of the drives. Another nasty thing - if the cable partially exits the connector during the system operation - can also bring a bunch of unpleasant consequences, up to physical breakdown (this, however, is unlikely). Therefore, the advice will be simple - connect the devices so as not to strain the cable. Other factors are unlikely to be taken into account.

Bus Mastering Drivers

The second important aspect of the disk system based on the IDE controller is the controller driver. From how the driver, and hence the operating system, will work with devices and the controller, in which mode the data will be exchanged, the overall performance of the system depends greatly.

Currently, there are two strategies for operating disks, the controller and the driver: the "standard" mode for older devices, in which all IDE drives are required to operate - the PIO (Programmed Input / Output) mode, in which a CPU is used to transfer data between the drive and the system . This mode works on all IDE-controllers, and is, in fact, the original mode of operation, regulated in the very first standard. Nevertheless, in the last few years, the vast majority of controllers and devices have an alternative mode of operation - the so-called Bus Mastering (DMA / UDMA) mode, in which the control of data transmission is carried out by the controller itself, without the participation of the processor. This mode not only frees the processor, which is very important in multitasking systems, but also removes the limitation on the data transfer rate imposed by the processor and software. In Windows NT4.0 and Windows 2000, for example, a driver running in PIO mode on my machine (Celeron 333A, BX chipset) can not provide a transfer rate of more than 5 MB / s from any of the three modern disks (Quantum 10 Gb, Seagate 6 GB and Seagate Barracuda 30 GB). In Bus Mastering mode, on the other hand, Seagate Barracuda, for example, gives 10 to 15 MB / s, which is almost three times (!) Faster, and the remaining drives reach their theoretical limit of 7 to 10 MB / s. Add to this the fact that for normal operation the processor load (personally from me) is 100%, and in Bus Mastering mode - about 20%, and you will understand why your system simply has to work in this mode.

Fortunately, all systems (motherboards) that have been released since Pentium, and even more so now, support Bus Mastering (hereinafter - BM) without any problems. The only problem that remains is to use this mode of operation of the equipment. Unfortunately, here and to this day there are some pitfalls.

Windows 98 / Windows ME

Modern computers based on these systems, in the vast majority of cases, already have drivers capable of working in BM mode - especially this applies to Windows ME. You can verify this in the following way: go to the control panel, point "system", and read the name of the hard disk controller in the device manager. If you have a motherboard on an Intel chipset, and the name has the words "Bus Master" or, sometimes, analogue in Russian ("bus management" or something like that) - then the necessary drivers are already installed. Users of modern (Pentium and above) systems based on VIA chipsets can be quiet - if you have a driver with a mention of VIA, and not a standard IDE driver, then BM is provided to you. If you still have only a standard IDE controller driver installed, then you will most likely need to install more new drivers. Windows 95 users, unfortunately, will have to look for drivers - there are no standard BM drivers in this system.

All that is left to do is make sure that all your devices work in this mode. To do this, in the same device manager, you need to walk through all the hard disks and CD / DVD drives, and put the "DMA" mode in the "Settings" tab for them. Different systems have different default parameters, and, probably, several of your devices will continue to work in PIO mode. It is worth paying attention, however, to the fact that some devices (especially older CD or CD-R [W] drives) may not work in DMA mode, or it may not work correctly. Sometimes it happens, for example, that the CD drive in DMA mode stops playing VideoCD or copy audio data. I also saw cases when the CD-RW drive stopped working in DMA mode altogether. Take this note: if something has stopped working the way it used to, you will unfortunately have to give up using DMA on this device.

Windows 2000

In most cases, this system already has Bus Mastering drivers, and even uses them. All you can do is try to make sure that all devices use this access mode: the fact is that removable drive drives (CD, for example) often by default, during the installation of the system, are put in PIO mode just in case, Which is not always justified. You need to go to the device manager (it can be found in the tree, which is launched, for example, by right clicking on "my computer", manage), find IDE ATA / ATAPI controllers there, and check the settings for both controller channels ( Primary / Secondary IDE channel). In the Advanced Settings tab you can either check the current mode of the device and put the desired mode - DMA if available (DMA, if possible), if it is not installed.

Windows NT4.0

Users of this OS in the vast majority of cases will have to take more active steps in order to get work in the BM mode. Standard drivers for NT systems with SP3 and above already have BM support for Intel PIIX3 and higher controllers (they are used in i430 / i440 chipsets), but, unfortunately, in the overwhelming number of systems they can not use it independently due to an unsuccessful automatic procedure The definition of this regime. To determine if the BM is running on your system or not, you will be helped, for example, by the ConfigNT program , which will show the current modes of operation of the devices. If you see that the BM on your controller does not work, you have two options - either to turn on this mode forcibly (right in the same program - only for Intel i430 / i440 chipsets, very common though), or to install drivers with BM support.

Users of other chipsets (for example, from the same VIA, or the new Intel i8xx line) will have to install special drivers with Bus Mastering support.

  • Attention 1: Both variants can theoretically result in your system not being loaded for some reason, and it will be very difficult to restore it. Experienced users who know what to do in this case, I can advise in any case to create an emergency recovery disk (rdisk / s command), but in general I can be comforted by the fact that I have never encountered a situation when after switching on the BM mode, either Otherwise the system did not boot. If the driver finds that there is still no BM on your system, it will all just continue to work as usual.

  • Attention 2: Keep in mind that the old BM drivers for NT4.0 - for example, from Triones, or the old Intel drivers, do not know how to work with drives larger than 8 GB. Installing such drivers can be a disaster - for example, NTFS volumes that have areas beyond 8 GB from the beginning of the disk have a chance of being irreversibly damaged, as the system will set up "bad" clusters even when trying to read from inaccessible areas, leading to a loss Your data. I strongly recommend using the drivers, released at least in 1999, for Intel chipsets - version 4 and higher (the first digit of the version number).

Other OS

Fortunately, other modern operating systems (Linux, FreeBSD, BeOS, etc.) have more distinct support for Bus Mastering. All these systems, or rather their standard drivers (the latest versions of systems), have Bus Mastering support for almost all Intel controllers (and some for VIA), and they use all devices in the most optimal mode. Users of Unix systems, for example, will be able to verify this by following the messages that the driver gives at boot (if, of course, their system issues this information - Unix can be configured as desired). BeOS includes this mode by default, so sometimes you even have to solve the opposite problem: turn it off manually (if there are problems with booting the system). With the IDE controllers (motherboards) of other manufacturers, other than Intel and VIA, the situation is somewhat worse, and sometimes, unfortunately, and in no way - but you can get answers to these questions only by yourself studying your situation.

Sufficiently fresh Bus Mastering drivers for all common chipsets for Windows systems can be found at www.bmdrivers.com or on this site in the "Information Storage" or "System Boards" section of the IDE Bus Mastering driver .

Virtual Memory Settings

All modern operating systems use virtual memory - a special swap file that compensates for insufficient physical memory of the system. The main parameter related to the virtual memory system is the size of the file (or several files) of the paging.

  • The Windows 95/98 / ME system has by default a dynamic virtual memory file, which changes its size according to the current system needs. Does it make sense to interfere with this mode of operation by setting the minimum and maximum size manually? Yes, there is some sense in this. If you put the minimum paging file size around 200 - 300 MB (the maximum is at your discretion, but preferably at least 500 MB), you will save the system from unnecessary manipulations to dynamically change the file size. If after this procedure you also defragment your disk with a modern defragmenter that can work with a virtual memory file, you will get a little more performance. What is the minimum size of the virtual memory file to choose? As much as you do not mind, but more than 300 MB, perhaps, is not worth it.

  • Windows NT4.0 and Windows 2000 systems have a slightly different strategy for working with virtual memory - a dynamic change in the size of a virtual memory file is provided, but it is not a regular mode of operation. What is the common minimum size of paging files to choose? The only thing that can be said for certain - the default value is too low for effective work. Ordinary systems recommend a minimum somewhere around 200 - 300 MB, and complex computers such as publishing or, for example, graphic workstations, will not be superfluous and 500 MB. At the maximum size, I also recommend not to stint - the figures of the order of gigabytes will be just right. It practically does not affect the operation of the system in the usual way, but will avoid surprises and failures at the most crucial moments, for example, when working with huge documents.

  • Users of other OS can give, in general, the same recommendations: try to make sure that the virtual memory file does not change its size dynamically, as this reduces the system's performance and increases fragmentation.

Does it make sense to put the maximum possible size of the paging file? Unfortunately no. If the file contains all the necessary data (i.e., it does not increase during operation), then the system's performance is maximized, and it will not be possible to raise it by increasing the file size. Yes, with the increase in the virtual memory file, some effects that affect the speed of the paging system will be used, but they will be both for and against, and the practical speed will not at least have a noticeable effect.

Where and how to upload the swap file?

  • In case you have several logical disks, try to put the virtual memory file on that section that is closer to the physical beginning of the disk. The speed of read / write operations there is traditionally slightly higher, well, or, in extreme cases, no worse than in the rest of the disk. Unfortunately, to place virtual memory on another logical drive, trying to isolate it from the operating system files, it is meaningless - as long as the virtual memory file is on the same physical disk, you will not benefit by changing its logical location.

  • Virtual memory in a system with multiple hard drives is a more flexible issue. Try to place virtual memory where there are no program files - that is, outside the system partition. This will greatly improve performance. Many modern systems (for example, Windows NT4.0 and Windows 2000) can use virtual memory on several disks - but keep in mind: you should not even place part of the virtual memory on the same physical disk as the system itself. If you have three physical disks, then do not pay attention to their relative performance, and place the swap files on both non-system drives - this will also greatly improve performance, and the system itself will balance the loading of disks according to their speed. Just keep in mind that the virtual memory file is categorically contra-indicated to be placed on disks running in PIO mode.

  • On which file system to allocate virtual memory? This has no practical significance. It would be better if the cluster size on the disk where the virtual memory file is located was larger - but it's actually not very important.

  • Try not to create from scratch virtual memory on more than two-thirds partitioned - it almost always leads to the creation of a fragmented swap file. If you have no other choice, try to at least defragment the disk before increasing the size of the virtual memory files.

The structure of logical disks

What is better in terms of performance - one logical drive per 10 GB, or 3 GB allocated for the system, and 7 GB for any data? From the point of view of performance, it will almost always be much better to allocate a separate section of a small size (2 - 4 GB) for the system. This step will cause the system files accessed more or less at the same time to be on the areas of the physical disk that are close to each other - i.e. The physical "mutual fragmentation" of system files will be much lower. Especially it is necessary to take this moment into account for those who have system disks of tens of gigabytes in size. If you allocate 10% -20% of the capacity of a large disk (that is, about 2 GB) to the system logical disk, the time for finding the track when moving the disk head between the system files will be several times smaller than the time that must be spent for Move the head across the entire physical disk. If you install the system on a disk in a dozen or two GB, the system files will randomly spread out throughout this space, which will create unnecessary difficulties with simultaneous access to these files.

Is it worth it to split the disks in any other way? No, do not. Each logical disk during its use by the system (mount) makes it necessary to store a lot of (hundreds of KBytes) of service information in memory, and this reduces the amount of memory available to the system. Although this is not a very big loss, but from the point of view of the speed of the advantages in creating a multitude of logical disks, it is still less. This rule, however, has one exception: if you use the FAT32 system (and Windows98 / ME users do not have another standard file system), then you should not create logically disks larger than 10 - 15 GB. If you have a hard drive, say, about 40 GB, it will be more reasonable to do all the same several volumes, in addition to the system, and it is very desirable so that large volumes are not used at the same time. Other modern file systems do not have such limitations.

Conclusion

The disk system of specific operating systems can be optimized further - for example, by managing caching, changing the operating modes of file system drivers, etc. But, unfortunately, these settings are too specific for each particular operating system. The same article talks about common considerations common to all operating systems, and we can perhaps return to the question of optimizing specific systems.