Application programming on z/OS
Previous topic | Next topic | Contents | Glossary | Contact z/OS | PDF


Program management model in Language Environment

Application programming on z/OS

The Language Environment® program management model provides a framework within which an application runs. It is the foundation for all of the component models (condition handling, runtime message handling, and storage management) that comprise the Language Environment architecture.

The program management model defines the effects of programming language semantics in mixed-language applications, and integrates transaction processing and multithreading.

Some terms used to describe the program management model are common programming terms; other terms are described differently in other languages. It is important that you understand the meaning of the terminology in a Language Environment context as compared to other contexts.

Program management

Program management defines the program execution constructs of an application, and the semantics associated with the integration of various management components of such constructs.

Three entities, process, enclave, and thread, are at the core of the Language Environment program management model.

Processes

The highest level component of the Language Environment program model is the process. A process consists of at least one enclave and is logically separate from other processes. Language Environment generally does not allow language file sharing across enclaves nor does it provide the ability to access collections of externally stored data.

Enclaves

A key feature of the program management model is the enclave, a collection of the routines that make up an application. The enclave is the equivalent of any of the following:

  • A run unit, in COBOL
  • A program, consisting of a main C function and its sub-functions, in C and C++
  • A main procedure and all of its subroutines, in PL/I
  • A program and its subroutines, in Fortran.

In Language Environment, environment is normally a reference to the runtime environment of HLLs at the enclave level. The enclave consists of one main routine and zero or more subroutines. The main routine is the first to execute in an enclave; all subsequent routines are named as subroutines.

Threads

Each enclave consists of at least one thread, the basic instance of a particular routine. A thread is created during enclave initialization with its own runtime stack, which keeps track of the thread's execution, as well as a unique instruction counter, registers, and condition-handling mechanisms. Each thread represents an independent instance of a routine running under an enclave's resources.

Figure 1. Full Language Environment program model
Full Language Environment program model

Figure 1 illustrates the full Language Environment program model, with its multiple processes, enclaves, and threads. As the figure shows, each process is within its own address space. An enclave consists of one main routine, with any number of subroutines.

The threads can create enclaves, which can create more threads, and so on.

Condition-handling model

For single-language and mixed-language applications, the Language Environment runtime library provides a consistent and predictable condition-handling facility. It does not replace current HLL condition handling, but instead allows each language to respond to its own unique environment as well as to a mixed-language environment.

Language Environment condition management gives you the flexibility to respond directly to conditions by providing callable services to signal conditions and to interrogate information about those conditions. It also provides functions for error diagnosis, reporting, and recovery.

Message-handling model and national language support

A set of common message handling services that create and send runtime informational and diagnostic messages is provided by Language Environment.

With the message handling services, you can use the condition token that is returned from a callable service or from some other signaled condition, format it into a message, and deliver it to a defined output device or to a buffer.

National language support callable services allow you to set a national language that affects the language of the error messages and the names of the day, week, and month. It also allows you to change the country setting, which affects the default date format, time format, currency symbol, decimal separator character, and thousands separator.

Storage management model

Common storage management services are provided for all Language Environment-conforming programming languages; Language Environment controls stack and heap storage used at run time. It allows single-language and mixed-language applications to access a central set of storage management facilities, and offers a multiple-heap storage model to languages that do not now provide one. The common storage model removes the need for each language to maintain a unique storage manager, and avoids the incompatibilities between different storage mechanisms.





Copyright IBM Corporation 1990, 2010