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

Type checking in compiler design
Type checking in compiler designType checking in compiler design
Type checking in compiler designSudip Singh
 
Calculation of Cyclomatic complexity
Calculation of Cyclomatic complexityCalculation of Cyclomatic complexity
Calculation of Cyclomatic complexitynikshaikh786
 
Final networks lab manual
Final networks lab manualFinal networks lab manual
Final networks lab manualJaya Prasanna
 
12 process control blocks
12 process control blocks12 process control blocks
12 process control blocksmyrajendra
 
Software Engineering - Software Models
Software Engineering - Software ModelsSoftware Engineering - Software Models
Software Engineering - Software ModelsReddhi Basu
 
Internet connectivity
Internet connectivityInternet connectivity
Internet connectivityFabMinds
 
Feng’s classification
Feng’s classificationFeng’s classification
Feng’s classificationNarayan Kandel
 
41 page replacement fifo
41 page replacement fifo41 page replacement fifo
41 page replacement fifomyrajendra
 
Progress control
Progress controlProgress control
Progress controlashamarsha
 
Joins in databases
Joins in databases Joins in databases
Joins in databases CourseHunt
 
ADVANCE DATABASE MANAGEMENT SYSTEM CONCEPTS & ARCHITECTURE by vikas jagtap
ADVANCE DATABASE MANAGEMENT SYSTEM CONCEPTS & ARCHITECTURE by vikas jagtapADVANCE DATABASE MANAGEMENT SYSTEM CONCEPTS & ARCHITECTURE by vikas jagtap
ADVANCE DATABASE MANAGEMENT SYSTEM CONCEPTS & ARCHITECTURE by vikas jagtapVikas Jagtap
 
clock synchronization in Distributed System
clock synchronization in Distributed System clock synchronization in Distributed System
clock synchronization in Distributed System Harshita Ved
 
Ten Commandments of Formal Methods: A decade later
Ten Commandments of Formal Methods: A decade laterTen Commandments of Formal Methods: A decade later
Ten Commandments of Formal Methods: A decade laterJonathan Bowen
 
Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOCAbhayDhupar
 

What's hot (20)

Type checking in compiler design
Type checking in compiler designType checking in compiler design
Type checking in compiler design
 
Calculation of Cyclomatic complexity
Calculation of Cyclomatic complexityCalculation of Cyclomatic complexity
Calculation of Cyclomatic complexity
 
Introduction
IntroductionIntroduction
Introduction
 
Final networks lab manual
Final networks lab manualFinal networks lab manual
Final networks lab manual
 
Chapter17
Chapter17Chapter17
Chapter17
 
12 process control blocks
12 process control blocks12 process control blocks
12 process control blocks
 
Software Engineering - Software Models
Software Engineering - Software ModelsSoftware Engineering - Software Models
Software Engineering - Software Models
 
Pl sql-ch2
Pl sql-ch2Pl sql-ch2
Pl sql-ch2
 
Internet connectivity
Internet connectivityInternet connectivity
Internet connectivity
 
Feng’s classification
Feng’s classificationFeng’s classification
Feng’s classification
 
41 page replacement fifo
41 page replacement fifo41 page replacement fifo
41 page replacement fifo
 
Session bean
Session beanSession bean
Session bean
 
Progress control
Progress controlProgress control
Progress control
 
Concurrency
ConcurrencyConcurrency
Concurrency
 
Joins in databases
Joins in databases Joins in databases
Joins in databases
 
ADVANCE DATABASE MANAGEMENT SYSTEM CONCEPTS & ARCHITECTURE by vikas jagtap
ADVANCE DATABASE MANAGEMENT SYSTEM CONCEPTS & ARCHITECTURE by vikas jagtapADVANCE DATABASE MANAGEMENT SYSTEM CONCEPTS & ARCHITECTURE by vikas jagtap
ADVANCE DATABASE MANAGEMENT SYSTEM CONCEPTS & ARCHITECTURE by vikas jagtap
 
clock synchronization in Distributed System
clock synchronization in Distributed System clock synchronization in Distributed System
clock synchronization in Distributed System
 
Ten Commandments of Formal Methods: A decade later
Ten Commandments of Formal Methods: A decade laterTen Commandments of Formal Methods: A decade later
Ten Commandments of Formal Methods: A decade later
 
Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOC
 
DBMS Unit - 6 - Transaction Management
DBMS Unit - 6 - Transaction ManagementDBMS Unit - 6 - Transaction Management
DBMS Unit - 6 - Transaction Management
 

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

Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...masabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
 

Recently uploaded (20)

Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 

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)