Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Shareable programs (shared code)

Each module executed by a user is loaded into either the task-local class 6 memory or the memory for shareable programs (shared code). The modules in the task-local class 6 memory can be executed only by the task which caused them to be loaded there. These modules form the so-called private part of the program.

The memory for shared code is a memory area in which one and the same copy of the module to be executed can be executed simultaneously by several tasks. These shareable modules form the public part of a program and must be programmed as reentrant code. Such a program must dynamically request the data areas in which variable user-owned data is to be stored, and must create these areas in the class 6 memory of the related user. The user can either directly execute the shared code (with START-EXECUTABLE-PROGRAM or START-PROGRAM) or access it via a private program. The external references in private programs can be resolved automatically by program definitions (CSECTs, ENTRYs) in the shared code.

Advantages of shareable programs

  • Since a module is loaded only once, i.e. when it is first referenced, the loading time is saved for all subsequent calls to the module during the same session.

  • Demands on main memory and paging memory are reduced because all tasks can access a single copy of the object module in the shared code memory, i.e. there is no need for each task to have a separate copy in its own class 6 memory (see figure 5 for an example of system shared code).

  • The paging rate is reduced because only one copy resides in the paging area. Also, read-only pages do not have to be written out to paging memory when they are no longer needed in main memory, i.e. no updating of paging memory is necessary for them.

Program shareability is therefore worthwhile for larger programs which are to reside in memory for some time (in interactive and transaction processing mode) and possibly be used concurrently by a number of users.

Figure 5: Effects of program shareability

DBL offers various facilities for loading and managing shared code.