[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

General Programming Concepts: Writing and Debugging Programs

Thread Implementation Model

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 4.2.

AIX 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 4.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

In AIX 4.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

The "_r" versions have been kept as links to these libraries, to enable compatibility with user applications.

Threads Versions On AIX

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 4.3 conforms fully to the IEEE POSIX standard for threads APIs, IEEE POSIX 1003.1-1996.

Note: In AIX 4.2 threads were supported at a "Draft 4" level.

AIX 4.3 provides full support for applications compiled on AIX 4.2. 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 4.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 4.3 the use of the "_r" invocations is no longer required for creating a threaded application.

[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]