- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are thread libraries?
A thread is a lightweight of process and is a basic unit of CPU utilization which consists of a program counter, a stack, and a set of registers.
Given below is the structure of thread in a process −
A process has a single thread of control where one program can counter and one sequence of instructions is carried out at any given time. Dividing an application or a program into multiple sequential threads that run in quasi-parallel, the programming model becomes simpler.
Thread has the ability to share an address space and all of its data among themselves. This ability is essential for some specific applications.
Threads are lighter weight than processes, but they are faster to create and destroy than processes.
A thread library provides the programmer with an Application program interface for creating and managing thread.
Ways of implementing thread library
There are two primary ways of implementing thread library, which are as follows −
The first approach is to provide a library entirely in user space with kernel support. All code and data structures for the library exist in a local function call in user space and not in a system call.
The second approach is to implement a kernel level library supported directly by the operating system. In this case the code and data structures for the library exist in kernel space.
Invoking a function in the application program interface for the library typically results in a system call to the kernel.
The main thread libraries which are used are given below −
POSIX threads − Pthreads, the threads extension of the POSIX standard, may be provided as either a user level or a kernel level library.
WIN 32 thread − The windows thread library is a kernel level library available on windows systems.
JAVA thread − The JAVA thread API allows threads to be created and managed directly as JAVA programs.
- POSIX Thread Libraries
- What are Standard Libraries in C++?
- What are free libraries for Canvas in HTML5?
- What should be the order in which libraries are linked in GCC?
- What are some of the important Scientific Libraries used in Lua programming?
- What is Thread cancellation?
- Byte-compile Python libraries
- What are the ways in which a thread is created in Java?
- What are the methods and properties of the Thread class in C#?
- What is the concept of thread?
- Which collection classes are thread-safe in Java?
- What is the Thread class in Java?
- What is a daemon thread in Java?