Guardian Programmer's Guide

Table Of Contents
Managing Memory
Guardian Programmer’s Guide 421922-014
17 - 3
Managing the TNS User Data Segment
Specifying the Size of the TNS User Data Segment
You can specify the size of the user data segment to be any number of data pages of
2048 bytes each, up to a maximum of 128K bytes. You can set this size either by
using the compiler or Binder program or when you call the PROCESS_CREATE_ or
PROCESS_LAUNCH_ procedure.
To supply the size of the user data segment at compile/bind time, you set the compiler
directive for the appropriate high-level language. For example, in TAL you would set
the ?DATAPAGES directive. Refer to the appropriate compiler manual or your Binder
Manual for details.
To specify the size of the user data segment using the PROCESS_CREATE_ or
PROCESS_LAUNCH_ procedure, you must supply the memory-pages parameter.
This parameter specifies a number of 2K-byte data pages.
The following example uses the PROCESS_CREATE_ procedure to create an
unnamed process with six user data pages:
OBJFILE ':=' "PROGFILE" -> @S^PTR;
OBJFILENAME^LENGTH := @S^PTR '-' @OBJFILE;
NAME^OPTION := 0;
MEMORY^PAGES := 6;
ERROR := PROCESS_CREATE_(OBJFILE:OBJFILENAME^LENGTH,
!library^file:lib^file^len!,
!swap^file:swap^file^len!,
!ext^swap^file:ext^swap^file^len!,
!priority!,
!processor!,
PROCESS^HANDLE,
!error^detail!,
NAME^OPTION,
!name:length!,
PROCESS^DESCRIPTOR:MAXLEN,
PROCESS^DESCRIPTOR^LENGTH,
!nowait^tag!,
!hometerm:length!,
MEMORY^PAGES);
If you specify the number of data pages both as a compiler or Binder directive and as a
parameter to the PROCESS_CREATE_ or PROCESS_LAUNCH_ procedure, the
system uses the larger of the two values.
Using the Data Stack
The data stack occupies the first 64K bytes of the user data segment. It contains
global data, local data for the main procedure, and dynamic local data for other TNS
procedures.
Figure 17-2 shows how the data stack is used.
Figure 17-2(a) shows the stack before the main procedure starts to execute. Note that
immediately after the global data is a zero entry called the dummy stack marker. The