QUOTING ARTISOFT BULLETIN: The SHARE Command Explained What is SHARE? The SHARE.EXE program is included with DOS versions 3.0 and higher. Although most DOS manuals don't give it much coverage, understanding SHARE can be vital to the success of your network, especially if you are running a multi-user database, or a similar application that works with several files at a time. SHARE gives applications an easy, well-defined way to keep users from accessing the same files, or the same regions of files simultaneously. Once SHARE has been run, an application can use it to "lock" a files or region so that only one person at a time can make changes. Most multi-user and network software packages use SHARE to implement their file and record locking. This bulletin will discuss how SHARE works and how it can affect your LANtastic network. How SHARE Works SHARE maintains two tables in memory. The first table, the FILES table, contains the complete pathname of each file that has been opened, plus an internal file handle number and other housekeeping information. The second table, the LOCK table, contains a list of internal file handle numbers and corresponding information on the various areas of each file that are locked. SHARE checks these tables whenever an application asks to open or use a file or a region of a file, and lets the application know whether or not the file or region is available. SHARE uses at least one entry in each table for each file that is opened. The more files your computer opens and locks, the more space SHARE needs for its internal tables. You can control the size of SHARE's internal tables with two command line options, /F and /L. The /F option controls the amount of space allocated for the FILES table and the /L option controls the number of simultaneous locks that SHARE will allow. To help you figure out exactly how much space you'll need, let's examine each parameter in detail. The /F Parameter The /F parameter controls the size (in bytes) of the table that SHARE reserves for file names and file handles. The syntax for using the /F parameter is SHARE /F:n where n is any number from 0 to approximately 62,000 (by empirical test). The default is /F:2048. SHARE stores the complete pathname of each file, plus 11 bytes of file handle and housekeeping information. You can find the worst case space requirement by multiplying the number of files in your CONFIG.SYS by 71 (60 bytes for the worst case pathname + 11 bytes for other information). For a system with FILES = 255 in its CONFIG.SYS, that means that in the worst case, with all 255 files open, SHARE will require over 18,100 bytes for the FILES table. On a network server, you will need to allocate enough space for all the files that will be opened by all the users on the network. The default value is 2048 bytes -- enough to hold the information for 66 files with paths averaging 20 characters, or about 28 files in a worst case scenario. If you know that paths on your machine average more than 20 characters, or that you will be opening lots of files, you should probably use the /F parameter to give SHARE more space for its FILES table. The /L Parameter The /L parameter controls the number of simultaneous locks that SHARE can handle. It's probably the biggest potential troublemaker for network users. The syntax for the /L parameter is SHARE /L:n where n is any integer between 1 and approximately 3800 (again, by empirical test). The default is /L:20 -- that is, 20 locks. On a network like LANtastic, which can open 5100 files per server, it's easy to see that 20 locks just isn't enough. Opening a file on a server requires at least one lock. In addition, most network programs use several more locks per file. They lock individual records, and even individual fields within records. Multi-user databases especially can use lots of locks, sometimes 10 or more per file. On a network, with several users opening each file, SHARE's default 20 locks can be used up almost instantly. To add to the confusion, application programs behave in a somewhat unpredictable manner when SHARE runs out of locks. Some programs correctly report the error, some simply report "Access Denied" or "Sharing Violation", and some just lock up the computer. The bottom line is that on your servers, you should use the /L parameter to increase the number of locks allowed. The /L setting should be at least the number of files you've specified in your CONFIG.SYS or in the NET_MGR Server Startup Parameters option (whichever is larger). If you're running a multi-user program that uses lots of files, you should consider setting /L to at least twice the number of open files allowed.