Reentrant program
A program written so that it never changes itself, which lets many tasks run the same copy of it at the same time.
Also written reentrant, RENT, reentrancy, reusable program
A reentrant program never changes its own code or the data built into it while it runs. Any data that changes is kept in storage that belongs to each caller. Because of that, one copy of the program in memory can be used by many tasks at the same moment, and each task sees its own data.
This matters in several places. Programs in the LPA must be reentrant, because every address space shares them. CICS runs many tasks of the same transaction through one copy of each program, so its programs must be at least quasi-reentrant. Programs used as DB2 stored procedures and in many system functions must be reentrant too.
COBOL programs are made reentrant with the RENT compiler option, and Enterprise COBOL then keeps working storage separate for each caller. The program is also marked reentrant when it is link-edited. In assembler, reentrancy has to be designed by the programmer.
A program that claims to be reentrant but is not can cause very confusing errors, such as one user seeing another user's data. That is why reentrancy is checked carefully for shared programs.
Where can I learn this hands-on?
Right here, at ZedBank. You take a junior job at a simulated bank and learn each part of the work by doing it, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- LPAThe link pack area: a part of storage shared by every address space, holding programs that many tasks use at once.
- CICS taskOne run of a CICS transaction; many tasks for the same transaction can run in a region at the same time.
- Compiler optionsSettings that control how the COBOL compiler builds a program, which can change both its speed and its behaviour.
- Load moduleThe runnable form of a program, stored in a library, which JCL executes by name.
- Link-editCombining compiled object code with the other modules it needs into a single runnable program.