Progress
Programming
Handbook


Standard R-code Execution Environment

At run-time, Progress manages the execution of a standard r-code procedure from either an operating system file or a standard procedure library using the following components:

Progress uses the segment descriptor table and the r-code directory to manage r-code procedures from operating system files, standard libraries, and memory-mapped libraries.

Figure A–2 shows the layout for the standard r-code execution environment.

Figure A–2: Standard R-code Execution Environment

In Figure A–2, Progress located and loaded the cust.r and orders.r files into local memory from either operating system files or standard libraries. The execution buffer is shown with three cust.r segments and two orders.r segments. Note that one orders.r segment is located in the execution buffer, while the other segment is swapped to the session sort file. When space in the execution buffer is needed for new r-code segments, Progress uses the session sort file to swap out the least-recently used segments. When Progress needs a segment that has been swapped to the session sort file, it reloads the segment from the session sort file into the execution buffer.

Standard Execution Sequence

When you run a standard r-code procedure for the first time, from either an operating system file or a standard library, Progress loads and executes the procedure as follows:

  1. Opens the procedure file (.p or .r) or procedure library (.pl), if the library is not already open.
  2. Reads the r-code procedure into memory and creates an r-code directory entry for the procedure. Progress first compiles a procedure into r-code, if necessary.
  3. Registers each required r-code segment in the execution environment as follows:
    1. Loads the r-code segment at the head of the segment chain in the execution buffer
    2. Adds an r-code segment entry to the segment descriptor table that references the segment in the execution buffer
    3. Inserts a segment descriptor reference in the r-code directory entry for the procedure
    4. If all the required r-code segments do not fit in the execution buffer, Progress attempts to free space by swapping r-code segments already in the buffer to the session sort file. If Progress cannot free enough space by swapping segments, it increases the execution buffer ceiling and allocates more space for the execution buffer.

      NOTE: When accessing r-code procedures stored in a standard library, Progress does not swap r-code segments to the session sort file unless you specify the PROLIB Swap (–pls) startup parameter. By default, if Progress needs an r-code segment in a standard library, it reloads the segment into the execution buffer from the library in local memory.

  4. Once the required r-code segments in the procedure are registered in the execution environment, the interpreter begins executing the r-code procedure at the start of the main action code segment and accesses the remaining segments directly from local memory as required.
Standard Execution Environment Limits

The number of standard r-code procedures that you can run at one time and the memory used are determined by the following factors:

Standard R-code Segment Management

While Progress loads an r-code file, all of its segments are locked in memory. After all required segments are loaded for the procedure, Progress unlocks all segments except its main action code and text segment. These two segments stay locked in memory until execution of the r-code file terminates. Internal procedure action code segments stay locked only until they return to the invoking procedure and are relocked each time they execute.

When a standard r-code segment does not fit in the execution buffer, Progress attempts to free space by swapping r-code segments already in the buffer to the session sort file. Progress can swap out any unlocked segments. Progress removes these segments from the tail end of the execution buffer chain, in least recently used (LRU) order.

If Progress cannot free enough memory for a newly loaded segment by swapping out older segments, it dynamically increases the maximum execution buffer size (execution buffer ceiling) and allocates the required memory up to the memory available.

When Progress needs a segment that has been swapped to the sort file, it reloads the segment from the sort file into the execution buffer. However, Progress keeps the reloaded segments in the sort file.

NOTE: When accessing r-code procedures stored in a standard library, Progress does not swap r-code segments to the session sort file unless you specify the PROLIB Swap (–pls) startup parameter. By default, if Progress needs an r-code segment in a standard library, it reloads the segment into the execution buffer from the library in local memory.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095