Artisoft			Technical Document


Title:		LANtastic and SHARE
Updated:	01/97
Description:	SHARE Explained. A discussion on the many variations of 
Share, be it DOS SHARE.EXE, Server Internal Share, or Vshare.386 from 
Windows.
FileName:	share.txt
FaxReturn#:	4001
Pages:		5


*NOTE: Make sure you have applied the latest patches and updates to 
LANtastic.

What is SHARE? SHARE.EXE is included with DOS versions 3.0 and higher. 
Server Internal Share and Vshare are discussed at the end of this 
document. Although most DOS manuals don't give SHARE.EXE much coverage, 
understanding it can be vital to the success of your network, especially 
if you are running a multi-user database, or 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 file 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 Files are Opened on a LANtastic Server: If your program requires 20 
file handles for a single user to run the application, then the LANtastic 
server and workstations CONFIG.SYS file must have 20 files handles 
available for the workstation to open the application from the server over 
a redirected drive.

When a second workstation runs the same application from the same server 
another 20 file handles must be available on the server for the second 
loading of the program.  The second workstation however will only need 20 
file handles available in CONFIG.SYS.

Therefore, in the above example, the server must have FILES=40 in 
CONFIG.SYS or the second workstation will not be able to run the 
application.

One can see by the above information that a LANtastic server can quickly 
run out of available file handles.  This is the reason for the 
implementation of the ability of LANtastics SERVER program to open 
additional file handles, since DOS is limited to a maximum of 255 
available file handles.

How SHARE Works: SHARE maintains two tables in memory, FILES and LOCKS. 
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 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 it 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 control the size of these tables with two 
command line options, /F and /L. 

The /F Parameter: The /F parameter controls the size (in bytes) of the 
table that SHARE reserves for file names and file handles.  Each open file 
requires space for the path + 11 bytes.  Microsoft estimates the average 
path length to be 20 characters.  Thus the default value of 2048 bytes is 
sufficient for 66 simultaneously open files (2048 / (20+11)).  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 2048. SHARE stores the complete pathname 
of each file, plus 11 bytes for 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, this means in the worst case, with all 255 files open, SHARE wi
ll 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 every user on the network. Using the default 
of 2048 bytes there would be enough space to hold 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 SHARE can handle. It's probably the biggest potential troublemaker 
for network users. Its syntax is:

SHARE /L:n     where "n" is any integer between 1 and approximately 3800 
(again, by empirical test). The default is 20 locks. On a network like 
LANtastic, which can open 5100 files per server, it's easy to see why 20 
locks just isn't enough.

Opening a file on a server requires at least one lock. Additionally, 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 
are used up almost instantly. 

To add to the confusion, application programs behave in an unpredictable 
manner when SHARE runs out of locks. Some correctly report the error, some 
simply report "Access Denied" or "Sharing Violation", others 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. 

SERVER INTERNAL SHARE: Server Internal Share is much the same as SHARE.EXE 
that runs under DOS. One of the benefits you get when using Server's 
Internal Share is now you are only loading one program instead of two. 
Allowing you to free additional memory for setups where it is sorely 
needed. The internal SHARE module in Server hooks the appropriate vectors 
to get called even when local applications do opens, reads, writes, locks, 
etc. 

Some applications do not use standard DOS vector lookups to detect share, 
instead they use back door methods and they may not find a share and 
cause problems.  These problems include sharing violations, corrupted 
data, etc.  Make sure you have updated LANtastic to the latest patched 
version.  If you are still having problems with your application and 
LANtastic share, notify tech support of the incompatibility and as a 
workaround: DISABLE Internal Share and use DOS share.

If, on a non-dedicated server, you redirect a drive to yourself, then 
these applications see the target as a network drive and is better behaved 
in checking for SHARE. There are problems with doing this however if you 
intend to run Windows on that server. (Please see our Windows bulletins on 
this issue).

WINDOWS VSHARE.386: The VSHARE.386 virtual device driver provides full 
compatibility with the SHARE.EXE provided with the version of MS-DOS you 
are using. The major difference is SHARE.EXE statically allocates the 
file-sharing table size and locks allowed at startup, thus these settings 
cannot change until that machine is rebooted. VSHARE.386 dynamically 
allocates memory for the file- sharing functionality, and can increase (or 
decrease) its allocation when additional resources are requested by the 
system.

If DOS SHARE.EXE is loaded before loading Windows, VSHARE.386 will stop 
the TSR but won't remove it from memory. It will assume the file-sharing 
and locking responsibility from SHARE.EXE.

"RSC: SFT not in SFT list, Share Internal Error" is normally associated 
with the presence of VSHARE.386 in the [386Enh] section of the System.ini 
file. 9 times out of 10 if you remove that line your problem will go 
away.  The 10th time I have found it associated with a hardware conflict. 
Either an Interrupt or IOBASE or RAMBASE issue. 

Normally what happens, VSHARE builds its own internal list of locks while 
Windows is running. As long as you stay within Windows all normally is 
fine. The problem steps in when you leave Windows and return to DOS. You 
lose the tables VSHARE has been working with and DOS SHARE.EXE or Server 
internal SHARE gets a disorganized list. Which may or may not work from 
that point on. What the error message represents is shares attempt to look 
at the table in memory and associate one of the pointers with something it 
is doing. It can't so it gives the error.

Artisoft, Inc.
2202 N. Forbes Blvd			 
Tucson, AZ  85745		
				
Internet 
  web:				http://www.artisoft.com	
  ftp:				ftp.artisoft.com
FaxReturn: 			520-884-1397
ArtiFacts bbs:			520-884-8648 (8 bits,No parity,1 
stop bit)
Sales Consultation Center:  	(800) 846-9726  
			  FAX (520) 670-7359
Customer Service:	      	(800) 846-9726
Technical Support Information:	(520) 670-7000

ARTISOFT TECHNICAL SUPPORT
Artisoft offers a wide selection of technical support options.  For
information regarding technical support services, please refer to 
our Directory of Support Services, available where you obtained 
this Technical Note.
Check Technical Support & Services on our Home Web Page, 
request FaxReturn document 4, or download the file DIRLIST.TXT).  
You can also obtain this information by calling Artisoft at (520) 670-7000.

DISCLAIMER:

THIS INFORMATION MAY BE INTERNAL OR EXTERNAL TO ARTISOFT 
AND IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
EXPLICIT OR IMPLIED.  ARTISOFT DISCLAIMS ALL WARRANTIES AND 
SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, 
INDIRECT, OR PUNITIVE DAMAGES, OR LOST PROFITS OR REVENUE, EVEN 
IF IT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.  SOME 
STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR 
CONSEQUENTIAL OR INCIDENTAL DAMAGES, SO THE FOREGOING 
LIMITATION MAY NOT APPLY TO YOU.

Brand names, company names, and product names are trademarks of their 
respective companies.
