There are various thread implementation models. One model is the "library-thread model." In such a model, the threads of a process are not visible to the operating system kernel, and the threads are not kernel scheduled entities. The process is the only kernel scheduled entity. The process is scheduled onto the processor by the kernel according to the scheduling attributes of the process. The threads are scheduled onto the single kernel scheduled entity (the process) by the run-time library according to the scheduling attributes of the threads. This is the model of threads provided on AIX Version 3.
At the other end of the spectrum is the "kernel-thread model." In this model, all threads are visible to the operating system kernel. Thus, all threads are kernel scheduled entities, and all threads can concurrently execute. The threads are scheduled onto processors by the kernel according to the scheduling attributes of the threads. This model is the model provided in AIX Version 4.1 and AIX Version 4.2.
AIX Version 4.3 uses a hybrid model that offers the speed of library threads and the concurrency of kernel threads. In hybrid models, a process has a varying number of kernel scheduled entities associated with it. It also has a potentially much larger number of library threads associated with it. Some library threads may be bound to kernel scheduled entities, while the other library threads are multiplexed onto the remaining kernel scheduled entities. For this reason, a hybrid model is referred to as a "M:N" model. In this model, the process can have multiple concurrently executing threads; specifically, it can have as many concurrently executing threads as it has kernel scheduled entities.
Thread-safe and Threaded Libraries in AIX
In AIX Version 4 Releases 1 and 2, special versions of selected libraries were provided, that were for use by threaded applications. These libraries were counterparts of the non-thread-safe libraries, but with the suffix "_r" added to the name. These libraries were:
libc.a/libc_r.a | libbsd.a/libbsd_r.a |
libm.a/libm_r.a | libnetsvc.a/libnetsvc_r.a |
libs.a/libs_r.a | libs2.a/libs2_r.a |
libsvid.a/libsvid_r.a | libtli.a/libtli_r.a |
libxti.a/libxti_r.a |
In AIX Version 4 Release 3, the need for these "_r" versions has been eliminated. By default, all applications are now considered "threaded," even though most are of the case "single threaded." These thread-safe libraries are now:
libbsd.a | libc.a | libm.a |
libsvid.a | libtli.a | libxti.a |
libnetsvc.a |
The "_r" versions have been kept as links to these libraries, to enable compatibility with user applications.
In order to bring threaded application support to our users, AIX introduced threads API models based on preliminary drafts of the now-official IEE POSIX standard. AIX Version 4 Release 3 conforms fully to the IEEE POSIX standard for threads APIs, IEEE POSIX 1003.1-1996.
AIX Version 4 Release 3 provides full support for applications compiled on AIX Version 3 Release 2 and AIX Version 4. It also provides compilation support for applications written to the "Draft 7" level that are not able to modify their source code to full standard conformance.
Compiling a Threaded Application
In AIX Version 4 Releases 1 and 2, "_r" versions of the C compiler invocations were offered that allowed the proper libraries and command line options to be set for creating a threaded application.
In AIX Version 4 Release 3 the use of the "_r" invocations is no longer required for creating a threaded application.