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 is a user level library with no kernal
support.
All code and data structures for the library
exist in user space.
Invoking a function in the library results in
a Local function call in user sapce and not a
system call.
The second is a kernal-level library supported
directly by the operating system.
In this case,code and data structures for the
library exist in kernal sapce.
Invoking a function in the API for the library
typically results in a system call to the kernal.
There are three type of Thread libraries:
POSIX thread - Pthread
Win 32 thread - Windows
Java Thread
The main thread libraries:
POSIX thread- the library includes pthreads.h header file.
The POSIX thread provided as either a user level or a
kernal level library.
Win 32 library -is similar to pthread library.
To create s thread using the Win 32 library alwaya include
windows.h header file in the program.
The windows library is a kernal level library available on
windows system
JAVA thread - The java thread API allows threads to be
created and managed directly as JAVA programs.
Pthreads:
The POSIX standard defines the specification for
pthreads,not the implementation.
pThreads are available on Solaris,Linux,Unix,Mac
OSX,and via public domain shareware for Windows.
Global variables are share among all thread.
One thread can wait for the other to
rejoin before continuing.
pthreads begin execution in a specified
function,in this example the
runner()function.
pthread.h is the header file used in C
language
:
#inculde<pthread.h>
intpthread_create(pthread_t*thread_id,
const pthread_attr_t*attribute,
void*(*routine)(void*),void*arg);
The Windows thread:
The windows thread library is a kernal-level
library available on windows systems.
Many function similar to pthread.
The header file is windows.h
create_Thread()-to create thread.
Attributes are similar to pthread along
with,security,stack size,flag to indicate current
state.
if flag=0,then SUSPENDED
Java Thread:
The java virtual machine JVM runs on the top
of the host operating system.
In the Windows operating system,the java
threads are implemented using Pthread.
In LINUX and UNIX, the java thread is
implemented using Pthread library.
In a java program, there is at least one thread
of control.
there are two methode to creating a thread
in java program.
1. Thread class and override it’s run() method.
2. Define a class and implement a Runnable
interface to it,
the second method is the most common
method to be used.

What are thread libraries in operating system

  • 2.
    A thread libraryprovides the programmer with an API for creating and managing threads. There are two primary ways of implementing a thread library.
  • 3.
    The first isa user level library with no kernal support. All code and data structures for the library exist in user space. Invoking a function in the library results in a Local function call in user sapce and not a system call.
  • 4.
    The second isa kernal-level library supported directly by the operating system. In this case,code and data structures for the library exist in kernal sapce. Invoking a function in the API for the library typically results in a system call to the kernal.
  • 5.
    There are threetype of Thread libraries: POSIX thread - Pthread Win 32 thread - Windows Java Thread
  • 6.
    The main threadlibraries: POSIX thread- the library includes pthreads.h header file. The POSIX thread provided as either a user level or a kernal level library. Win 32 library -is similar to pthread library. To create s thread using the Win 32 library alwaya include windows.h header file in the program. The windows library is a kernal level library available on windows system JAVA thread - The java thread API allows threads to be created and managed directly as JAVA programs.
  • 7.
    Pthreads: The POSIX standarddefines the specification for pthreads,not the implementation. pThreads are available on Solaris,Linux,Unix,Mac OSX,and via public domain shareware for Windows. Global variables are share among all thread.
  • 8.
    One thread canwait for the other to rejoin before continuing. pthreads begin execution in a specified function,in this example the runner()function. pthread.h is the header file used in C language
  • 9.
  • 10.
    The Windows thread: Thewindows thread library is a kernal-level library available on windows systems. Many function similar to pthread. The header file is windows.h
  • 11.
    create_Thread()-to create thread. Attributesare similar to pthread along with,security,stack size,flag to indicate current state. if flag=0,then SUSPENDED
  • 12.
    Java Thread: The javavirtual machine JVM runs on the top of the host operating system. In the Windows operating system,the java threads are implemented using Pthread. In LINUX and UNIX, the java thread is implemented using Pthread library.
  • 13.
    In a javaprogram, there is at least one thread of control. there are two methode to creating a thread in java program.
  • 14.
    1. Thread classand override it’s run() method. 2. Define a class and implement a Runnable interface to it, the second method is the most common method to be used.