Thread program models

There are different models for creating multithread programs.

One of the key differences between the IBM® i operating system and other operating systems is the ability of IBM i to support a call-return program model. On other platforms, if one program wants to call another program, it must start a second process to run the second program, or must replace the first program with the second. Starting another process to call a program is expensive in terms of startup time and system resources. To avoid this expense, programmers group commonly used functions into dynamically linked libraries (DLLs). Whenever a program needs a service that a DLL provides, the program loads the DLL and calls the function that provides the needed service.

Although the IBM i call-return program model is supported for multithreaded programs, you are strongly encouraged to use service programs or DLLs that run in the caller's activation group. If you perform ports of multithreaded programs from other platforms, you will naturally employ service programs in your ports.

Although it is not a requirement, all programs used in a multithreaded application should be Integrated Language Environment® (ILE) programs. The use of the original program model (OPM) in multithreaded programs requires special considerations. You must evaluate the thread safety of existing ILE or OPM programs if multithreaded programs call them.