2. A thread library provides the programmer with
an API for creating and managing threads.
There are two primary ways of implementing a
thread library.
3. 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.
4. 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.
5. There are three type of Thread libraries:
POSIX thread - Pthread
Win 32 thread - Windows
Java Thread
6. 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.
7. 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.
8. 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
10. 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
12. 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.
13. In a java program, there is at least one thread
of control.
there are two methode to creating a thread
in java program.
14. 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.