COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

Memory and Virtual Memory
Memory is one resource consumed by a process. Each processor in an HP system has its own
physical memory. Each processor in a system can have one to four increments of memory, and
different processors in the same system can have different amounts of memory. The size of the
increments depends on the type of processor—see the system description manual for your processor.
The operating environment allows several processes to occupy different areas of physical memory
concurrently. It manages these processes with a virtual memory mechanism. The active portions of
a process reside in physical memory. The inactive portions remain in physical memory only as
long as the number of active processes remains small. As the number of active processes grows,
the inactive portions of processes tend to remain on disk in virtual memory. The unit of memory
allocation is the page, whose size depends on the processor. See the system description manual
for your processor.
The virtual memory for process code consists of the loadfile.
The virtual memory for process data consists of temporary disk storage, allocated at the time the
process is created.
A process can modify its data but not its code; therefore, the operating environment can fetch code
pages needed from disk but does not need to restore them to disk; the operating environment must
rewrite data pages to disk when their physical memory is surrendered.
The transfer of code and data pages between virtual memory on disk and physical memory is
directed by the memory manager process of the operating environment with the help of the disk
process.
The performance of any process is affected by the amount of time that is spent managing memory
instead of executing process instructions.
For more information about memory and its management, see the system description manual for
your processor.
Initiating a Process From an HP COBOL Program
Suppose you want to make your running HP COBOL program start a new process. This is different
from having your HP COBOL program call another program with a CALL or ENTER statement—you
want to cause an entirely independent process to execute asynchronously, perhaps on a different
processor of the system or on a different HP system. Use the CLU_PROCESS_CREATE_ routine.
For information on the CLU_PROCESS_CREATE_ routine, see the CRE Programmer’s Guide.
Communicating With a Process
On an HP system, all processes communicate directly with one another through the message system.
The basic mechanism for access to the message system is $RECEIVE.
$RECEIVE
$RECEIVE is like one end of a communications conduit. It is similar to a courier who brings you a
message and can be dismissed or sent back with a reply.
From the perspective of a process, $RECEIVE appears to be a sequential file. The syntax for
communicating with $RECEIVE in an HP COBOL program is, therefore, based on the syntax for
communicating with an ordinary HP COBOL sequential file.
To receive a message from another process (including the operating environment), a process must
read $RECEIVE.
To reply to a message, a process must write to $RECEIVE. The operating environment delivers the
reply to the originator of the message. The process does not need to determine where the message
came from to reply to it.
916 Process Initiation, Communication, and Management