Exercise 1 - Memory Allocation

This exercise focuses on the DosAllocMem() function and its usage. The sample program used in the exercise allocates and uses memory in order to illustrate the new memory allocation mechanism, particularly with regard to paged memory.

In this exercise, the student is required to run the program:

             MEMLAB1.EXE

This program does the following:

  • Asks for an amount of memory to be allocated, in integer-sized (4 byte) units.
  • Allocates and commits the requested amount of memory.
  • Asks for the amount of memory to be used for read/write operations. The amount of memory to be used is specified as the number of integers to be written then read.
  • Performs writes to fill the requested amount of memory.
  • Checks whether the written values are correct.
  • Frees the allocated memory.
  • At initiation the program registers two termination routines:

    The program will be executed three times during the course of the exercise. The program listing is shown in Source Code MEMLAB1.C.


    [Back: Objectives]
    [Next: Step 1 - Normal Memory Allocation]