SlideShare a Scribd company logo
1 of 14
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.

More Related Content

Similar to What are thread libraries in operating system

Operating System 4
Operating System 4Operating System 4
Operating System 4tech2click
 
multi-threading
multi-threadingmulti-threading
multi-threadingEzzat Gul
 
Operating Systems - "Chapter 4: Multithreaded Programming"
Operating Systems - "Chapter 4:  Multithreaded Programming"Operating Systems - "Chapter 4:  Multithreaded Programming"
Operating Systems - "Chapter 4: Multithreaded Programming"Ra'Fat Al-Msie'deen
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machineLaxman Puri
 
Slot02 concurrency1
Slot02 concurrency1Slot02 concurrency1
Slot02 concurrency1Viên Mai
 
Intro To .Net Threads
Intro To .Net ThreadsIntro To .Net Threads
Intro To .Net Threadsrchakra
 
Php and threads ZTS
Php and threads ZTSPhp and threads ZTS
Php and threads ZTSjulien pauli
 
Visual comparison of Unix-like systems & Virtualisation
Visual comparison of Unix-like systems & VirtualisationVisual comparison of Unix-like systems & Virtualisation
Visual comparison of Unix-like systems & Virtualisationwangyuanyi
 
Driver Programming Report
Driver Programming ReportDriver Programming Report
Driver Programming ReportShivek Khurana
 
Introto netthreads-090906214344-phpapp01
Introto netthreads-090906214344-phpapp01Introto netthreads-090906214344-phpapp01
Introto netthreads-090906214344-phpapp01Aravindharamanan S
 
A Comparison of .NET Framework vs. Java Virtual Machine
A Comparison of .NET Framework vs. Java Virtual MachineA Comparison of .NET Framework vs. Java Virtual Machine
A Comparison of .NET Framework vs. Java Virtual MachineAbdelrahman Hosny
 
OS Module-2.pptx
OS Module-2.pptxOS Module-2.pptx
OS Module-2.pptxbleh23
 
In Unix (and some other operating systems) a library is a collection.pdf
In Unix (and some other operating systems) a library is a collection.pdfIn Unix (and some other operating systems) a library is a collection.pdf
In Unix (and some other operating systems) a library is a collection.pdfaashwini4
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in javaRaghu nath
 

Similar to What are thread libraries in operating system (20)

Operating System 4
Operating System 4Operating System 4
Operating System 4
 
multi-threading
multi-threadingmulti-threading
multi-threading
 
P-Threads
P-ThreadsP-Threads
P-Threads
 
Operating Systems - "Chapter 4: Multithreaded Programming"
Operating Systems - "Chapter 4:  Multithreaded Programming"Operating Systems - "Chapter 4:  Multithreaded Programming"
Operating Systems - "Chapter 4: Multithreaded Programming"
 
Windows Kernel-
Windows Kernel-Windows Kernel-
Windows Kernel-
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machine
 
Slot02 concurrency1
Slot02 concurrency1Slot02 concurrency1
Slot02 concurrency1
 
Threads
ThreadsThreads
Threads
 
Treads
TreadsTreads
Treads
 
Intro To .Net Threads
Intro To .Net ThreadsIntro To .Net Threads
Intro To .Net Threads
 
Php and threads ZTS
Php and threads ZTSPhp and threads ZTS
Php and threads ZTS
 
Tutorial 2
Tutorial 2Tutorial 2
Tutorial 2
 
Visual comparison of Unix-like systems & Virtualisation
Visual comparison of Unix-like systems & VirtualisationVisual comparison of Unix-like systems & Virtualisation
Visual comparison of Unix-like systems & Virtualisation
 
Driver Programming Report
Driver Programming ReportDriver Programming Report
Driver Programming Report
 
linux installation.pdf
linux installation.pdflinux installation.pdf
linux installation.pdf
 
Introto netthreads-090906214344-phpapp01
Introto netthreads-090906214344-phpapp01Introto netthreads-090906214344-phpapp01
Introto netthreads-090906214344-phpapp01
 
A Comparison of .NET Framework vs. Java Virtual Machine
A Comparison of .NET Framework vs. Java Virtual MachineA Comparison of .NET Framework vs. Java Virtual Machine
A Comparison of .NET Framework vs. Java Virtual Machine
 
OS Module-2.pptx
OS Module-2.pptxOS Module-2.pptx
OS Module-2.pptx
 
In Unix (and some other operating systems) a library is a collection.pdf
In Unix (and some other operating systems) a library is a collection.pdfIn Unix (and some other operating systems) a library is a collection.pdf
In Unix (and some other operating systems) a library is a collection.pdf
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 

Recently uploaded

CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 

Recently uploaded (20)

CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 

What are thread libraries in operating system

  • 1.
  • 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
  • 11. 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
  • 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.