Thread Libraries in Operating System

A thread library provides the programmer with an API for creating and managing threads. There are two primary ways of implementing a thread library. The first approach is to provide a library entirely in user space with no kernel support.

All code and data structures for the library exist in user space. This means that invoking a function in the library results in a local function call in user space and not a system call

The second approach is to implement a kernel-level library supported directly by the operating system. In this case, code and data structures for the library exist in kernel space. Invoking a function in the API for the library typically results in a system call to the kernel

Three main thread libraries are in use today: POSIX Pthreads, Windows, and Java. Pthreads, the threads extension of the POSIX standard, may be provided as either a user-level or a kernel-level library.

The Windows thread library is a kernel-level library available on Windows systems.

The Java thread API allows threads to be created and managed directly in Java programs. However, because in most instances the JVM is running on top of a host operating system, the Java thread API is generally implemented using a thread library available on the host system.

This means that on Windows systems, Java threads are typically implemented using the Windows API; UNIX and Linux systems often use Pthreads

Leave a Comment