A job is a container for storage and other resources. A
job cannot run by itself.
Every job has two basic kinds of storage associated with it.
- Data:
- Data is where all of the program variables are stored. It is broken down
into storage for global and static variables (static), storage for dynamically
allocated storage (heap), and storage for variables that are local to the
function (automatic). The storage for program variables is allocated from
the activation group into which the program was activated. Static and heap
storage are accessible to all threads that are running in the activation group.
The automatic storage and local program variables are local to the thread.
- Stack:
- The stack contains data about the program or procedure call flow in a
thread. The stack, along with automatic storage, is allocated for each thread
created. While in use by a thread, the stack and automatic storage are considered
to be thread resources. When the thread ends, these resources return to the
process for subsequent use by another thread.
Job resources are resources that are accessible by all threads within the
job. These resources are as follows:
- Coded character set identifier (CCSID)
- Locales
- Environment variables
- File descriptors
- Files that are opened with a job scope
- Signal action vector
- Signal timers
- The current working directory
All threads running in an activation group can share activation group resources,
such as static and heap storage. When a thread changes a job resource, the
new value is immediately visible to all threads. For example, changing the
signal handling action in one thread effectively changes the signal handling
action in all threads.