Exercise 3 - Multiple DOS Sessions
This exercise demonstrates how an OS/2 protected mode program may start
a DOS program in a virtual DOS machine. Furthermore, the growth of the
swap file is shown, as well as the decrease in the size of the swap file
after termination of the OS/2 program.
The program used in this exercise makes use of the DosStartSession() function.
In this exercise, the student is required to run the memory lab program:
MEMLAB3.EXE
Syntax: MEMLAB3 <no. of DOS sessions>
The steps in the program are as follows:
If a parameter is passed to the program, it will
use this as the number of DOS sessions to start. If no parameter is provided,
four DOS sessions are started.
The program reads a file named: MEMLAB3.PRO.
A sample MEMLAB3.PRO is shown in Sample
Input File for MEMLAB3.EXE.
The file must be created using an ASCII editor such as the OS/2 V2.0 System
Editor and consists of three lines as follows:
a)
The full path and file name of the swap file.
b)
c)
The parameter string which is to be passed
to the DOS program.
If no parameters are to be passed, an empty line must still appear in the
file. In the example this is AUTOEXEC.BAT
3.
The program starts the specified number of DOS
sessions, if possible, with the current system resources. Before starting
any sessions, the program displays the size of the swap file. After each
session is started the new size of the swap file is displayed.
4.
When the requested number of DOS sessions is started
or the system resources are exhausted, the program will wait for a keystroke
in order to terminate.
5.
When
the keystroke is received by the program all the DOS sessions are terminated.
After terminating each session the swap file size is displayed. The program
continues to monitor and display the swap file every 10 seconds until it
remains unchanged for a period of 100 seconds.
The program listing is shown in Source
Code MEMLAB3.C.
You should perform the following steps:
- Although MEMLAB3 does give information about
the swap file size, you may also want to use the SWAPSIZE program which
is described in Program to Display
Swap File Size to monitor the changes in the size of SWAPPER.DAT. If
so start this program now.
- Run the MEMLAB3 program and notice how the swap
file size increases as the sessions are started.
- Terminate the program and watch the decrease
in size of the swap file over time.
Note the 512KB steps in which the swap file size increases and decreases.
If you are able to do the exercise Please do so now. If not, refer
to the following explanation.
[Back: Source Code MEMLAB2.C]
[Next: Expected Results from Exercise 3]