Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

Multithreading facility

Creating a thread
ATTACH statement
Examples
Terminating a thread
Waiting for a thread to complete
Detaching a thread
Condition handling
Task data and attribute
THREADID built-in function
Sharing data between threads
Sharing files between threads

A PL/I program is a set of one or more procedures. The program normally executes as a single execution unit, or as part of a single execution unit. When a procedure invokes another procedure, control is passed to the invoked procedure, and execution of the invoking procedure is suspended until the invoked procedure passes control back. This execution with a single flow of control is synchronous flow.

When using the PL/I multithreading facility, the invoking procedure does not relinquish control to the invoked procedure. Instead, an additional flow of control is established so that both procedures are executed concurrently. The execution of such concurrent procedures is called asynchronous flow.

The PL/I multithreading facility allows the execution of parts of a PL/I program asynchronously in multiple threads. A thread is a unit of work that competes for the resources of the computing system. A thread is not the equivalent of a task in OS PL/I. Except for the main thread in a program, a thread is always independent of and unrelated to other threads in the program. When a procedure invokes another procedure as a thread, this action is known as attaching, or creating the thread.

Execution of one or more threads occurs in a process, which can be thought of as a PL/I program. PL/I does not provide the capabilities to create and manage multiple processes or tasks, but it does allow creation and management of multiple threads in a single program (process).

There is normally one application thread per process. Multiple threads can be attached (created) to:

Note:
Operating system services must not be directly used when PL/I provides the appropriate function.

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)