SlideShare a Scribd company logo
1 of 19
POSIX vs. Win32 Threads In depth threading techniques 1 Robert.Sayegh@gmail.com   (2008)
This presentation provides a summary based on few articles regarding threads in Win32 and POSIX systems. All these articles are mentioned in the References slide. Disclaimer 2 Robert.Sayegh@gmail.com   (2008)
What is Thread1. Processes What is a Process A process is created by OS to run your Main program. Contains all information to be handled by the OS. Process ID, process group ID, user ID, and group ID  Environment Scheduling Properties (priority, etc.) Working directory.  Program instructions  Registers,    Stack,    Heap  File descriptors  Signal actions  Shared libraries  Inter-process communication tools    shared memory ,      message queues,    semaphores ,            pipes,  3 Robert.Sayegh@gmail.com   (2008)
What is Thread2. Threads ,[object Object]
A thread is created by OS to run a stream of instructions.
Threads contain smaller set of information
Scheduling Properties
Registers
Stack
Signal actions
Light-Weight	Most overhead accomplished through maintaining its process.  ,[object Object]
Has its own independent flow of control (as long as its parent process exists and the OS supports it)
Duplicates only essential resources for independent schedulingComparing timing results in POSIX for the fork() and pthreads_create()(reflecting 50,000 creations) shows 30-60 times overhead! 4 Robert.Sayegh@gmail.com   (2008)
[object Object]
File open or close at the process level.
Memory Sharing (Same address, same data).Two pointers having the same value, exist in the same virtual memory and point to the same data.
No copy is needed!
Synchronization required.As resources and memory sharing is possible, explicit synchronization is required by the programmerThreads Sharing 5 Robert.Sayegh@gmail.com   (2008)
Win32 vs. POSIX Interface1. Function calls 6 Robert.Sayegh@gmail.com   (2008)

More Related Content

What's hot

Microkernel architecture
Microkernel architecture Microkernel architecture
Microkernel architecture RQK Khan
 
Embarqués temps réel
Embarqués temps réelEmbarqués temps réel
Embarqués temps réelmikhailether
 
Leaky bucket algorithm
Leaky bucket algorithmLeaky bucket algorithm
Leaky bucket algorithmUmesh Gupta
 
37 segmentation
37 segmentation37 segmentation
37 segmentationmyrajendra
 
Linux booting process - Linux System Administration
Linux booting process - Linux System AdministrationLinux booting process - Linux System Administration
Linux booting process - Linux System AdministrationSreenatha Reddy K R
 
Operating Systems 1 (7/12) - Threads
Operating Systems 1 (7/12) - ThreadsOperating Systems 1 (7/12) - Threads
Operating Systems 1 (7/12) - ThreadsPeter Tröger
 
Réseaux des neurones
Réseaux des neuronesRéseaux des neurones
Réseaux des neuronesMed Zaibi
 
message passing vs shared memory
message passing vs shared memorymessage passing vs shared memory
message passing vs shared memoryHamza Zahid
 
Kernel mode vs user mode in linux
Kernel mode vs user mode in linuxKernel mode vs user mode in linux
Kernel mode vs user mode in linuxSiddique Ibrahim
 
Distributed system architecture
Distributed system architectureDistributed system architecture
Distributed system architectureYisal Khan
 
Memory Management in Amoeba
Memory Management in AmoebaMemory Management in Amoeba
Memory Management in AmoebaRamesh Adhikari
 
Système d’exploitation: Principe
Système d’exploitation: PrincipeSystème d’exploitation: Principe
Système d’exploitation: PrincipeSouhaib El
 

What's hot (20)

Microkernel architecture
Microkernel architecture Microkernel architecture
Microkernel architecture
 
Embarqués temps réel
Embarqués temps réelEmbarqués temps réel
Embarqués temps réel
 
Leaky bucket algorithm
Leaky bucket algorithmLeaky bucket algorithm
Leaky bucket algorithm
 
37 segmentation
37 segmentation37 segmentation
37 segmentation
 
Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)
 
Linux booting process - Linux System Administration
Linux booting process - Linux System AdministrationLinux booting process - Linux System Administration
Linux booting process - Linux System Administration
 
System calls
System callsSystem calls
System calls
 
Operating Systems 1 (7/12) - Threads
Operating Systems 1 (7/12) - ThreadsOperating Systems 1 (7/12) - Threads
Operating Systems 1 (7/12) - Threads
 
Réseaux des neurones
Réseaux des neuronesRéseaux des neurones
Réseaux des neurones
 
message passing vs shared memory
message passing vs shared memorymessage passing vs shared memory
message passing vs shared memory
 
Virtualization
Virtualization Virtualization
Virtualization
 
Ooad
OoadOoad
Ooad
 
Kernel mode vs user mode in linux
Kernel mode vs user mode in linuxKernel mode vs user mode in linux
Kernel mode vs user mode in linux
 
Expl couches osi
Expl couches osiExpl couches osi
Expl couches osi
 
Distributed system architecture
Distributed system architectureDistributed system architecture
Distributed system architecture
 
Memory Management in Amoeba
Memory Management in AmoebaMemory Management in Amoeba
Memory Management in Amoeba
 
Memory management in linux
Memory management in linuxMemory management in linux
Memory management in linux
 
Système d’exploitation: Principe
Système d’exploitation: PrincipeSystème d’exploitation: Principe
Système d’exploitation: Principe
 
RAID LEVELS
RAID LEVELSRAID LEVELS
RAID LEVELS
 
Shell programming
Shell programmingShell programming
Shell programming
 

Viewers also liked

Diagrama de bloque procesador intel
Diagrama de bloque procesador intelDiagrama de bloque procesador intel
Diagrama de bloque procesador intelCristian Paredes
 
Graphical user interface of web form
Graphical user interface of web formGraphical user interface of web form
Graphical user interface of web formmentorrbuddy
 
Graphical User Interface
Graphical User Interface Graphical User Interface
Graphical User Interface Bivek Pakuwal
 
User interfaces presentation
User interfaces presentationUser interfaces presentation
User interfaces presentationsomipam1
 
Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1PRN USM
 
Graphical User Interface (Gui)
Graphical User Interface (Gui)Graphical User Interface (Gui)
Graphical User Interface (Gui)Bilal Amjad
 
human computer interface
human computer interfacehuman computer interface
human computer interfaceSantosh Kumar
 

Viewers also liked (11)

Diagrama de bloque procesador intel
Diagrama de bloque procesador intelDiagrama de bloque procesador intel
Diagrama de bloque procesador intel
 
User Interface
User InterfaceUser Interface
User Interface
 
Gui
GuiGui
Gui
 
Matlab GUI
Matlab GUIMatlab GUI
Matlab GUI
 
Graphical user interface of web form
Graphical user interface of web formGraphical user interface of web form
Graphical user interface of web form
 
Graphical User Interface
Graphical User Interface Graphical User Interface
Graphical User Interface
 
Matlab GUI
Matlab GUIMatlab GUI
Matlab GUI
 
User interfaces presentation
User interfaces presentationUser interfaces presentation
User interfaces presentation
 
Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1
 
Graphical User Interface (Gui)
Graphical User Interface (Gui)Graphical User Interface (Gui)
Graphical User Interface (Gui)
 
human computer interface
human computer interfacehuman computer interface
human computer interface
 

Similar to PThreads Vs Win32 Threads

Processes and Threads in Windows Vista
Processes and Threads in Windows VistaProcesses and Threads in Windows Vista
Processes and Threads in Windows VistaTrinh Phuc Tho
 
Operating system Definition Structures
Operating  system Definition  StructuresOperating  system Definition  Structures
Operating system Definition Structuresanair23
 
WEEK07operatingsystemdepartmentofsoftwareengineering.pptx
WEEK07operatingsystemdepartmentofsoftwareengineering.pptxWEEK07operatingsystemdepartmentofsoftwareengineering.pptx
WEEK07operatingsystemdepartmentofsoftwareengineering.pptxbabayaga920391
 
Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2mona_hakmy
 
Operating System 4
Operating System 4Operating System 4
Operating System 4tech2click
 
[iOS] Multiple Background Threads
[iOS] Multiple Background Threads[iOS] Multiple Background Threads
[iOS] Multiple Background ThreadsNikmesoft Ltd
 
Driver Programming Report
Driver Programming ReportDriver Programming Report
Driver Programming ReportShivek Khurana
 
Posix threads(asha)
Posix threads(asha)Posix threads(asha)
Posix threads(asha)Nagarajan
 
OS Module-2.pptx
OS Module-2.pptxOS Module-2.pptx
OS Module-2.pptxbleh23
 
Interview Question of Aspdotnet
Interview Question of AspdotnetInterview Question of Aspdotnet
Interview Question of AspdotnetMohitKumar1985
 
Operating Systems R20 Unit 2.pptx
Operating Systems R20 Unit 2.pptxOperating Systems R20 Unit 2.pptx
Operating Systems R20 Unit 2.pptxPrudhvi668506
 
An isas presentation on .net framework 2.0 by vikash chandra das
An isas presentation on .net framework 2.0 by vikash chandra dasAn isas presentation on .net framework 2.0 by vikash chandra das
An isas presentation on .net framework 2.0 by vikash chandra dasVikash Chandra Das
 
Dotnet interview qa
Dotnet interview qaDotnet interview qa
Dotnet interview qaabcxyzqaz
 
Inside .net framework
Inside .net frameworkInside .net framework
Inside .net frameworkFaisal Aziz
 

Similar to PThreads Vs Win32 Threads (20)

Case Study 2: WINDOWS VISTA
Case Study 2: WINDOWS VISTACase Study 2: WINDOWS VISTA
Case Study 2: WINDOWS VISTA
 
Processes and Threads in Windows Vista
Processes and Threads in Windows VistaProcesses and Threads in Windows Vista
Processes and Threads in Windows Vista
 
Operating system Definition Structures
Operating  system Definition  StructuresOperating  system Definition  Structures
Operating system Definition Structures
 
WEEK07operatingsystemdepartmentofsoftwareengineering.pptx
WEEK07operatingsystemdepartmentofsoftwareengineering.pptxWEEK07operatingsystemdepartmentofsoftwareengineering.pptx
WEEK07operatingsystemdepartmentofsoftwareengineering.pptx
 
Topic 4- processes.pptx
Topic 4- processes.pptxTopic 4- processes.pptx
Topic 4- processes.pptx
 
Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2
 
Operating System 4
Operating System 4Operating System 4
Operating System 4
 
Windows 2000
Windows 2000Windows 2000
Windows 2000
 
Concept of thread
Concept of threadConcept of thread
Concept of thread
 
Os
OsOs
Os
 
[iOS] Multiple Background Threads
[iOS] Multiple Background Threads[iOS] Multiple Background Threads
[iOS] Multiple Background Threads
 
Driver Programming Report
Driver Programming ReportDriver Programming Report
Driver Programming Report
 
Posix threads(asha)
Posix threads(asha)Posix threads(asha)
Posix threads(asha)
 
OS Module-2.pptx
OS Module-2.pptxOS Module-2.pptx
OS Module-2.pptx
 
Linux vs windows
Linux vs windowsLinux vs windows
Linux vs windows
 
Interview Question of Aspdotnet
Interview Question of AspdotnetInterview Question of Aspdotnet
Interview Question of Aspdotnet
 
Operating Systems R20 Unit 2.pptx
Operating Systems R20 Unit 2.pptxOperating Systems R20 Unit 2.pptx
Operating Systems R20 Unit 2.pptx
 
An isas presentation on .net framework 2.0 by vikash chandra das
An isas presentation on .net framework 2.0 by vikash chandra dasAn isas presentation on .net framework 2.0 by vikash chandra das
An isas presentation on .net framework 2.0 by vikash chandra das
 
Dotnet interview qa
Dotnet interview qaDotnet interview qa
Dotnet interview qa
 
Inside .net framework
Inside .net frameworkInside .net framework
Inside .net framework
 

More from Robert Sayegh

Aligning the cogs - strategy for winning products.pdf
Aligning the cogs - strategy for winning products.pdfAligning the cogs - strategy for winning products.pdf
Aligning the cogs - strategy for winning products.pdfRobert Sayegh
 
Quick intro to scrum agile
Quick intro to scrum agileQuick intro to scrum agile
Quick intro to scrum agileRobert Sayegh
 
Get it Right the First Time
Get it Right the First TimeGet it Right the First Time
Get it Right the First TimeRobert Sayegh
 
SW Engineering Management
SW Engineering ManagementSW Engineering Management
SW Engineering ManagementRobert Sayegh
 
Assemblies versioning and signing
Assemblies versioning and signingAssemblies versioning and signing
Assemblies versioning and signingRobert Sayegh
 
Globalization Of Software
Globalization Of SoftwareGlobalization Of Software
Globalization Of SoftwareRobert Sayegh
 

More from Robert Sayegh (6)

Aligning the cogs - strategy for winning products.pdf
Aligning the cogs - strategy for winning products.pdfAligning the cogs - strategy for winning products.pdf
Aligning the cogs - strategy for winning products.pdf
 
Quick intro to scrum agile
Quick intro to scrum agileQuick intro to scrum agile
Quick intro to scrum agile
 
Get it Right the First Time
Get it Right the First TimeGet it Right the First Time
Get it Right the First Time
 
SW Engineering Management
SW Engineering ManagementSW Engineering Management
SW Engineering Management
 
Assemblies versioning and signing
Assemblies versioning and signingAssemblies versioning and signing
Assemblies versioning and signing
 
Globalization Of Software
Globalization Of SoftwareGlobalization Of Software
Globalization Of Software
 

Recently uploaded

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 

Recently uploaded (20)

Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 

PThreads Vs Win32 Threads

  • 1. POSIX vs. Win32 Threads In depth threading techniques 1 Robert.Sayegh@gmail.com (2008)
  • 2. This presentation provides a summary based on few articles regarding threads in Win32 and POSIX systems. All these articles are mentioned in the References slide. Disclaimer 2 Robert.Sayegh@gmail.com (2008)
  • 3. What is Thread1. Processes What is a Process A process is created by OS to run your Main program. Contains all information to be handled by the OS. Process ID, process group ID, user ID, and group ID Environment Scheduling Properties (priority, etc.) Working directory. Program instructions Registers, Stack, Heap File descriptors Signal actions Shared libraries Inter-process communication tools shared memory , message queues, semaphores , pipes, 3 Robert.Sayegh@gmail.com (2008)
  • 4.
  • 5. A thread is created by OS to run a stream of instructions.
  • 6. Threads contain smaller set of information
  • 11.
  • 12. Has its own independent flow of control (as long as its parent process exists and the OS supports it)
  • 13. Duplicates only essential resources for independent schedulingComparing timing results in POSIX for the fork() and pthreads_create()(reflecting 50,000 creations) shows 30-60 times overhead! 4 Robert.Sayegh@gmail.com (2008)
  • 14.
  • 15. File open or close at the process level.
  • 16. Memory Sharing (Same address, same data).Two pointers having the same value, exist in the same virtual memory and point to the same data.
  • 17. No copy is needed!
  • 18. Synchronization required.As resources and memory sharing is possible, explicit synchronization is required by the programmerThreads Sharing 5 Robert.Sayegh@gmail.com (2008)
  • 19. Win32 vs. POSIX Interface1. Function calls 6 Robert.Sayegh@gmail.com (2008)
  • 20. Win32 vs. POSIX Interface2. Synchronization overhead 7 Robert.Sayegh@gmail.com (2008)
  • 21. Historically, hardware vendors have implemented their own proprietary versions of threads. In Windows, the thread is the basic execution unit, and the process is a container that holds this thread. In Linux, the basic execution unit is the process Some may claim POSIX threads are a low-level API and Windows threads are a high-level API In Windows the thread scheduling code is implemented in the kernel. In Linux realm, there are several drafts of the POSIX threads standard. Differences between drafts exist! Especially many scheduling mechanisms exist (user and kernel-level threads). The current POSIX standard is defined only for the C language. More issues to consider 8 Robert.Sayegh@gmail.com (2008)
  • 22. Mapping Win32 to Pthreads1. Process Mapping Mappable: Both the Windows and Linux constructs provide similar functionality. Context: The decision to use a specific Linux construct(s) depends on the application context !! More on WaitForMultipleObjects may be found under the following reference: http://www.ibm.com/developerworks/linux/library/l-ipc2lin3.html 9 Robert.Sayegh@gmail.com (2008)
  • 23. Mapping Win32 to Pthreads2. Thread Mapping 10 Robert.Sayegh@gmail.com (2008) Mappable: Both the Windows and Linux constructs provide similar functionality. Context: The decision to use a specific Linux construct(s) depends on the application context
  • 24. Mapping Win32 to Pthreads3. Synchronization !! Conditional Variables: While mutexes implement synchronization by controlling thread access to data, condition variables allow threads to synchronize based upon the actual value of data. See more under: https://computing.llnl.gov/tutorials/pthreads 11 Robert.Sayegh@gmail.com (2008)
  • 25. Mapping Win32 to PthreadsSynchronization (semaphores) Notice: Win32 semaphores are created within a thread, and propagated all over the system. POSIX semaphores are wither for inter-thread within a process, or inter-process entities. !! opensemaphore function enables multiple processes to open handles of the same semaphore object. The function succeeds only if some process has already created the semaphore by using the CreateSemaphore function. 12 Robert.Sayegh@gmail.com (2008)
  • 26. Mapping Win32toPthreadsSynchronization (events) Notice (See conclusion in the next slide). - Events are Windows specific objects. - POSIX semaphores with count set to 1 provide similar functionality to the Windows events. However, they don't provide timeout in the wait functions. - Conditional variables & Mutexin pthreads provide event-based synchronization between threads, but they are synchronous. 13 Robert.Sayegh@gmail.com (2008)
  • 27. Mapping Win32toPthreadsSynchronization (events) - conclusion 14 Robert.Sayegh@gmail.com (2008)
  • 28. Mapping Win32toPthreadsSynchronization (mutex) Notice (See conclusion in the next slide).Some major differences reside, including: - Named and un-named mutexes. - Ownershiop at creation. - Timeout during wait. - Recursive mutexes. 15 Robert.Sayegh@gmail.com (2008)
  • 29. Mapping Win32toLinuxSynchronization (mutex) - conclusion 16 Robert.Sayegh@gmail.com (2008)
  • 30. Mapping Win32 to LinuxSynchronization (Critical Sections) Notice: Since the critical sections are used only between the threads of the same process, Pthreadsmutex can be used to achieve the same functionality on Linux systems. 1 - In general, mutex objects are more CPU intensive and slower to use than critical sections due to a larger amount of bookkeeping, and the deep execution path into the kernel taken to acquire a mutex. The equivalent functions for accessing a critical section remain in thread context, and consist of merely checking and incrementing/decrementing lock-count related data. This makes critical sections light weight, fast, and easy to use for thread synchronization within a process. 2- In Win32 The primary benefit of using a mutex object is that a mutex can be named and shared across process boundaries. 17 Robert.Sayegh@gmail.com (2008)
  • 31. References POSIX Threads Programminghttps://computing.llnl.gov/tutorials/pthreads/ Why pthreads are better than Win32http://softwarecommunity.intel.com/ISN/Community/en-US/forums/post/840096.aspx Why Windows threads are better than pthreads: http://softwareblogs.intel.com/2006/10/19/why-windows-threads-are-better-than-posix-threads/ Port Windows IPC apps to Linux (including code examples) http://www.ibm.com/developerworks/linux/library/l-ipc2lin1.html http://www.ibm.com/developerworks/linux/library/l-ipc2lin2.html http://www.ibm.com/developerworks/linux/library/l-ipc2lin3.html 18 Robert.Sayegh@gmail.com (2008)
  • 32. Thank you 19 Robert.Sayegh@gmail.com (2008)