SID %W% - %E% This README file replaces Chapter 7 of the 2.52 Install Manual. ---------------------------------------------------------------- CHAPTER 7: DOS - MEMORY MANAGEMENT ---------------------------------------------------------------- To gain optimal performance, you should be aware of the memory amount available to SmartWare. Note that available memory is affected by hardware configurations, network connections, SmartWare font types, etc. MEMORY TYPES ------------ Conventional Memory. This is low memory up to the 640KB available to DOS and DOS-based programs. High Memory. This is the remaining 384KB of address space above the 640KB of conventional memory and up to the 1MB address limit of the original IBM PC. ROM, BIOS, and video cards are located in this space. Expanded Memory. There are usually some unused addresses in the middle of the high memory area. Using bank switching, large amounts of RAM is made available through these high memory addresses. Extended Memory. This is memory above 1MB. PROTECTED MODE -------------- Standard DOS programs run in real mode. These applications use conventional memory but cannot use extended memory unless it is reconfigured as expanded memory, RAM disk, disk cache, etc. Programs that run in protected mode can also access extended memory. SmartWare is a protected mode program that uses both conventional and extended memory and, in some cases, expanded memory. EXECUTABLE MODES AND MEMORY CONFIGURATION ----------------------------------------- There are two modes that SmartWare can run under, both are protected mode programs: SMAR.EXE has been built for use by 'low-end' machines. It optimizes memory by logically grouping code segments and supports 286 machines. The smallest amount of physical memory that SMART.EXE can run on is 2MB. However, with only 2MB, almost all memory must be dedicated to SmartWare. Unnecessary TSRs such as SMARTDRV.EXE must be removed or modified to use a very small amount of memory. SMARTX.EXE has been optimized for speed. It requires a minimum of 3MB of physical memory and a 386 or better. It can run on 2MB machines but the performance is generally not acceptable. NOTE: The install program allows you to install one or both of these executables. With any virtual memory system, performance improves when the physical memory used is increased. So when configuring a PC to use SmartWare, try to free as much memory as possible. SmartWare does not require EMM386.EXE, and removing this may free over 200K of memory often leading to significantly improved performance, especially on 2MB machines. Note that in previous versions adding disk cache almost always improved performance. When using virtual memory, adding disk cache can sometimes actually decrease performance since less memory is available. This is especially true on machines with less than 3MB free. REPORTING MEMORY AVAILABLE FOR SmartWare ------------------------------------- The pminfo program reports on available memory and measures the performance of protected/real-mode switching. To find out how much memory is available for SmartWare, run pminfo, look for the line that reads "K bytes available for DOS/16M programs" and add the two preceding numbers together. For example: 513 13033 K bytes available for DOS/16M programs This example shows that there is 13546 KB (13.5 meg) available memory for SmartWare (and SMARTX). See also the section, Using the DOS16M Environment Variable. REPORTING FREE MEMORY UNDER SmartWare ---------------------------------- Among other things, the Control F1 key reports the amount of free memory and whether virtual memory is enabled. Due to the behavior and various 'features' of the DOS extenders and virtual memory managers used by SmartWare, you will notice some peculiar behavior with the numbers that are reported: with no VMM When running SMARTX or SMART without VMM, or when running under Windows, Ctrl F1 reports the total free memory as expected. However, memory is not 'unreserved' when it is freed, so this number will not get larger. For instance if you loaded a 1MB document, you would see the available memory go down. The number would not go up when the document is unloaded. Loading the 1MB document again will not affect the reported free memory. SMARTX, with VMM When using SMARTX with VMM enabled, the Ctrl F1 will only report the total virtual memory size. SMART, with VMM There is a bug when reporting the free memory with SMART.EXE when running VMM (which is the default). The numbers that are reported vary widely having little to do with the virtual memory available. VIRTUAL MEMORY -------------- SmartWare provides the ability to use parts of a hard disk to simulate memory (RAM). In this way, an application such as SmartWare can run within less than actual RAM. Virtual memory consists of available RAM plus a file existing on a hard disk or on a RAM drive. That file is called a Swap file. In a Virtual Memory system, when actual memory is used up, information residing in RAM is written out to a Swap file, thus freeing-up RAM. As information from the swap file is needed by the application, that code is swapped with other code from RAM. Virtual Memory automatically enabled. (Versions before 2.52B, required the -vm parameter during startup) For machines with 4MB free or more, you may want to disable virtual memory as some aspects of performance are improved when virtual memory is not running. Note that if you are loading very large documents or spreadsheets, you may still require virtual memory. To disable virtual memory use the -v0 start up flag. For example: smartx -v0 will disable virtual memory. Virtual Memory and the resulting Swap file are tunable. There are two methods to tune Virtual Memory: 1) through the use of start-up parameters, and, 2) through the use of a configuration file. Virtual memory is automatically disabled when running under windows, as the windows virtual memory manager should be used. VIRTUAL MEMORY START-UP PARAMETERS ---------------------------------- The available SmartWare start-up parameters can be viewed by use of the -x flag on SmartWare start-up. For example: SMARTX -X will result in a listing of all available SmartWare start-up parameters for the 386 version of SMARTWARE. That listing is reproduced below. To obtain the start-up parameters for the 286 version of SMARTWARE, enter: SMART -X SMARTWARE 386 START-UP PARAMETERS At the MS-DOS prompt, entering: SMARTX -X will produce the following: SMARTX.EXE [parameter ...] -x display this explanation -mod module specifier ( -cm, -db, -ss, -wp, c, d, s, w ) -a cmds execute the specified commands upon entering SmartWare -d path set the current data path -f ignore network driver -k use interrupts to read keyboard (needed for some TSR's & voice) -n ignore floating point co-processor -oa num set the size of the argument stack -oc file play key stroke file upon entering SmartWare -od [file] display the given file upon entry (default=start.msg) -oe set default project file execution to be in-memory -oh num change max number of open files (default=255) -oi turn off the intro screen -om [file] search for a menu keyword file (default=smart.mnu) -op num set the size of the print buffer (default=500) -ot num set the size of the string stack -p file automatically execute file upon entering SmartWare -s path set the path where SmartWare is located -m str memory configuration (See READVMM.TXT for details) -v0 disable virtual memory -vf file swap file to use for virtual memory (default=C:\SMART.SWP) -vd delete swap file on exit (default=no) -vn num minimum swap file size, less cushion (default=128K) -vx num maximum swap file size (default=32768K) -vi num swap file increment size (default=512K) -vs num size of virtual memory in K bytes (default=32768K) -vc file virtual memory configuration file (default=none) -vu num maximum amount of physical memory (low & ext) (def=4096K) See READVMM.TXT for details on virtual memory and memory configuration The flags beginning with a "-v" are the Virtual Memory start-up parameters. These are explained below: -v0 Disable virtual memory. -vf file The Swap file path and name to use for Virtual Memory. The default name is SMART.SWP that will reside in the root directory on the "C" drive. -vd Delete the Swap file on exit. The default is to leave it there, which will take up disk space. If you don't want to leave the Swap file in place after exiting SMARTWARE, then enable this option. -vn num Sets the minimum, or initial, size of the swap file in KB. The default is 128K. This can be set as low as 1K. As SMARTWARE requires swap space, the Swap file will grow to meet the needs of SMARTWARE. -vx num Sets the maximum Swap file size in KB. The Swap file will grow no larger than this maximum size. The default is 32MB for the 386 version of SMARTWARE and 16MB for the 286 version. If disk space is at a premium, then set this to a much lower value. The lowest settable value will depend on the amount of available memory. -vi num The incremental growth value of the Swap file in KB. The default is 512K, meaning that the Swap file will grow in 512K byte -vs num Sets the maximum size, in KB, of Virtual Memory. Virtual memory can grow no larger than this value. The default is the maximum Swap file size. -vc file Identifies a Virtual Memory configuration file to be used at start-up. There is no default configuration file. This file, which is explained below, can contain all necessary Virtual Memory start-up parameters. Included in the "bin" directory are two sample Virtual Memory configuration files, one each for the 286 and 386 versions of SMARTWARE. These files may be edited and used for your own purposes. -vu num Sets the maximum amount of physical memory, in KB, available to the Virtual Memory manager. The default is 4MB. The physical memory can include memory from 0-640KB + any extended memory available to the Virtual Memory manager. SMARTWARE 286 START-UP PARAMETERS At the MS-DOS prompt, entering SMART -X will produce the same listing as above, with the addition of one extra flag, as defined below: -ve num Sets the expanded memory swap size, if expanded memory is available for use by the Virtual Memory manager. The default is 0K. Use this option if expanded memory is also available. This will reduce the need for extended memory. SMARTWARE VIRTUAL MEMORY MANAGER CONFIGURATION FILES Included in the "bin" directory of SMARTWARE are two sample Virtual Memory configuration files entitled VM286.VMC, and VM386.VMC. These files can be edited and used to configure Virtual Memory at SMARTWARE start-up. The contents of the VM286.VMC is listed below. ! Sample VMM configuration file. The -v flags refer to the ! SMARTWARE start-up parameters. ! SWAPMIN=128 Minimum Swap file size is 512K. See -vn flag SWAPSIZE=16384 Takes no more than 4MB for user. See -vx flag VIRTUALSIZE=16384 Max Virtual memory is 4MB. See -vs flag MAXMEM=4096 Max Physical memory available to VMM. See -vu flag SWAPNAME=C:\SMART.SWP The path and name of the swap file. See -vf flag NODELETESWAP The swap file is deleted at exit. See -vd flag SWAPINC=512 Virtual memory grows in 512K blocks. See -vi flag EMS=0 No EMS memory for VMM (286 Only.) See -ve flag RESERVELOW=16 Reserve 16K of DOS memory for SmartWare. See -r flag MINMEM=128 Min physical memory required is 128K FREELOW Free DOS memory during a shell ! ! Comments may follow configuration elements in the same line separated by ! tabs or spaces. Comment-only lines must begin with a ! (exclamation point) ! NO BLANK LINES ARE ALLOWED IN THIS FILE. A BLANK LINE WILL TERMINATE ! PROCESSING OF THIS FILE. Two other parameters are available for the VMM configuration file. These parameters may be useful to your environment: MINMEM = num Specifies, in KB, the minimum memory that VMM is to manage. NOSWAPFILE Tells VMM not to create a swap file. If you wish for VMM to use only memory, set MAXMEM to the size of available memory, then specify NOSWAPFILE. USING -M FLAG ------------- The -m flag allows you to specify a string which affects how the DOS Extender uses memory. This section describes how to use the -m flag. Normally, you do not need to use the -m parameter. It may (or must) be used if one or more of the following conditions are true: - You are using a Fujitsu FMR-series, NEC 98-series, OKIif800-series or Hitachi B-series machine. - You need to coexist with older programs that use extended memory but do not follow one of the standard disciplines. - You want to shell out of SMARTWARE to use another program that requires extended memory. - You want to restrict the memory that SMARTWARE uses for other reasons. The general syntax of the -m parameter is: -m where is "[machine_type] [@base_address-end_address][:size] [options]" For example: SMARTX -M :4MB will tell SMARTX not to use more than 4MB of RAM. Note that if the string has spaces, it must be enclosed in quotes. For example: SMARTX -M "1 @2m-4m" would be used for the NEC 98 series and specifies to use extended memory between 2 and 4MB. The machine_type is only required for rare non AT compatible machines. The following table shows the machine and corresponding value: Machine Setting NEC 98-series 1 Fujitsu FMR-60,-70 5 Hitachi B32 14 OKIif800 15 some IBM PS/55's 16 The addresses can be decimal or hexidecimal (hex requires 0x prefix). The number may end with a K to indicate an address or size in kilobytes, or an M to indicate megabytes. If no suffix is given, the number is assumed to be kilobytes. If both a size and a range are specified, the more restricted interpretation is used. The -m flag is only available with SMARTX.EXE. With SMARTX.EXE, the -m startup flag is used to specify how much and which memory should be used. The most flexible strategy is to only specify a size. However, if you are running with software that does not follow a convention for indicating its use of extended memory, and these programs start before SMARTWARE, you will need to calculate a range of memory to be used by the other programs and specify a range of memory for SMARTWARE. Some examples are: SMARTX -M :2M Uses the last full two megabytes of extended memory, or as much as available limited to 2MB. SMARTX -M @2m Use any extended memory available above 2MB. SMARTX -M @0-5m Use any available extended memory from 0.0 (really 1.0) to 5.0MB. As a default, SMARTX takes all extended memory that is not in use. Multiple DOS/4GW programs that execute simultaneously will share the reserved range of memory. Any non DOS/4GW programs started while SMARTWARE is running will not find extended memory unless it is explicitly set aside with -M. This is very safe. There will be a conflict only if the other program does not check the BIOS configuration call (Int 15H, 88H) to get extended memory size. To create a private pool of extended memory, use the PRIVATXM program described below. SMARTWARE will use all of its extended memory before attempting to use DOS (low) memory. Under a VCPI or DPMI environment (I.e. a Windows or OS2 DOS Box), the range is ignored. The size option can be used but it will not necessarily allocate from the highest available. Note that SMARTWARE ignores specifications (or parts of specifications) that conflict with other information about extended memory use. PRIVATXM.EXE ------------ PRIVATXM.EXE is a TSR used to allow SMARTX.EXE to run with software packages created with DOS/16M 4.01 or earlier. It is not required for SMART.EXE. When run, a private memory pool is created for active DOS/16M programs. The memory is released when PRIVATXM -R is run. The following commands show the use of PRIVATXM when starting a DOS/16M TSR prior to running SMARTX. set DOS16M=:10240 (sets maximum memory use to 10MB for old DOS/16M TSR) TSR (command to start TSR) PRIVATXM (run PRIVATXM.EXE) set DOS16M= (clear DOS16M so it doesn't affect SMARTWARE) SMARTX (start SMART) PRIVATXM -R (causes TSR memory to be freed when TSR terminates) RARELY USED RUNTIME OPTIONS --------------------------- SMARTX supports runtime options that may be useful in some rare circumstances. To set a run time option, append ^