SlideShare uma empresa Scribd logo
1 de 38
Threads
Process ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
UNIX Process
Threads ,[object Object]
Cont. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
UNIX Thread
UNIX Threads ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pthreads  ,[object Object],[object Object]
Pthreads ,[object Object]
Creating threads ,[object Object]
Creating threads (cont.) ,[object Object],[object Object],[object Object]
Creating threads (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Cont. ,[object Object],[object Object],[object Object]
Thread attributes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Scheduling threads ,[object Object],[object Object]
Terminating threads ,[object Object],[object Object]
Joining Threads ,[object Object],[object Object],[object Object],[object Object],[object Object]
Joining Threads (Cont.)
Example -1-
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Code Explanation
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Cont. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Possible Outputs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example -2-
[object Object],[object Object],[object Object],[object Object]
Code Explanation
[object Object],[object Object],[object Object],[object Object],[object Object]
Cont. ,[object Object],[object Object],[object Object],[object Object]
Output ,[object Object],[object Object],[object Object],[object Object]
Example -3- Example 1 while using pthread_join()
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Possible Outputs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example -4-
[object Object],[object Object]
Output ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
Output ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Mais conteúdo relacionado

Mais procurados

Pointers & References in C++
Pointers & References in C++Pointers & References in C++
Pointers & References in C++Ilio Catallo
 
Антихрупкий TypeScript | Odessa Frontend Meetup #17
Антихрупкий TypeScript | Odessa Frontend Meetup #17Антихрупкий TypeScript | Odessa Frontend Meetup #17
Антихрупкий TypeScript | Odessa Frontend Meetup #17OdessaFrontend
 
C++ Memory Management
C++ Memory ManagementC++ Memory Management
C++ Memory ManagementAnil Bapat
 
Modern C++ Concurrency API
Modern C++ Concurrency APIModern C++ Concurrency API
Modern C++ Concurrency APISeok-joon Yun
 
Unit 4
Unit 4Unit 4
Unit 4siddr
 
Unit 5
Unit 5Unit 5
Unit 5siddr
 
C++aptitude questions and answers
C++aptitude questions and answersC++aptitude questions and answers
C++aptitude questions and answerssheibansari
 
STL ALGORITHMS
STL ALGORITHMSSTL ALGORITHMS
STL ALGORITHMSfawzmasood
 
Python Advanced – Building on the foundation
Python Advanced – Building on the foundationPython Advanced – Building on the foundation
Python Advanced – Building on the foundationKevlin Henney
 
Lecture02 class -_templatev2
Lecture02 class -_templatev2Lecture02 class -_templatev2
Lecture02 class -_templatev2Hariz Mustafa
 
Unit 6
Unit 6Unit 6
Unit 6siddr
 
An Overview Of Standard C++Tr1
An Overview Of Standard C++Tr1An Overview Of Standard C++Tr1
An Overview Of Standard C++Tr1Ganesh Samarthyam
 
Python For Scientists
Python For ScientistsPython For Scientists
Python For Scientistsaeberspaecher
 
ZCA: A component architecture for Python
ZCA: A component architecture for PythonZCA: A component architecture for Python
ZCA: A component architecture for PythonTimo Stollenwerk
 

Mais procurados (20)

Pointers & References in C++
Pointers & References in C++Pointers & References in C++
Pointers & References in C++
 
Антихрупкий TypeScript | Odessa Frontend Meetup #17
Антихрупкий TypeScript | Odessa Frontend Meetup #17Антихрупкий TypeScript | Odessa Frontend Meetup #17
Антихрупкий TypeScript | Odessa Frontend Meetup #17
 
C++ Memory Management
C++ Memory ManagementC++ Memory Management
C++ Memory Management
 
Modern C++ Concurrency API
Modern C++ Concurrency APIModern C++ Concurrency API
Modern C++ Concurrency API
 
The Style of C++ 11
The Style of C++ 11The Style of C++ 11
The Style of C++ 11
 
Unit 4
Unit 4Unit 4
Unit 4
 
Unit 5
Unit 5Unit 5
Unit 5
 
C++aptitude questions and answers
C++aptitude questions and answersC++aptitude questions and answers
C++aptitude questions and answers
 
STL ALGORITHMS
STL ALGORITHMSSTL ALGORITHMS
STL ALGORITHMS
 
Python Advanced – Building on the foundation
Python Advanced – Building on the foundationPython Advanced – Building on the foundation
Python Advanced – Building on the foundation
 
Lecture02 class -_templatev2
Lecture02 class -_templatev2Lecture02 class -_templatev2
Lecture02 class -_templatev2
 
Arrays in C++
Arrays in C++Arrays in C++
Arrays in C++
 
Operating System Assignment Help
Operating System Assignment HelpOperating System Assignment Help
Operating System Assignment Help
 
Unit 6
Unit 6Unit 6
Unit 6
 
Pthread
PthreadPthread
Pthread
 
Idiomatic C++
Idiomatic C++Idiomatic C++
Idiomatic C++
 
An Overview Of Standard C++Tr1
An Overview Of Standard C++Tr1An Overview Of Standard C++Tr1
An Overview Of Standard C++Tr1
 
Arduino - Classes and functions
Arduino - Classes and functionsArduino - Classes and functions
Arduino - Classes and functions
 
Python For Scientists
Python For ScientistsPython For Scientists
Python For Scientists
 
ZCA: A component architecture for Python
ZCA: A component architecture for PythonZCA: A component architecture for Python
ZCA: A component architecture for Python
 

Destaque

Stroustrup c++0x overview
Stroustrup c++0x overviewStroustrup c++0x overview
Stroustrup c++0x overviewVaibhav Bajaj
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Railshasan2000
 
Process Synchronization And Deadlocks
Process Synchronization And DeadlocksProcess Synchronization And Deadlocks
Process Synchronization And Deadlockstech2click
 
Operating System 5
Operating System 5Operating System 5
Operating System 5tech2click
 
Unit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - ThreadsUnit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - Threadscscarcas
 
Unit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process SynchronizationUnit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process Synchronizationcscarcas
 
Ch3 OS
Ch3 OSCh3 OS
Ch3 OSC.U
 
Ch4 OS
Ch4 OSCh4 OS
Ch4 OSC.U
 
Ch2 OS
Ch2 OSCh2 OS
Ch2 OSC.U
 
Chapter 9 OS
Chapter 9 OSChapter 9 OS
Chapter 9 OSC.U
 
Operating system.ppt (1)
Operating system.ppt (1)Operating system.ppt (1)
Operating system.ppt (1)Vaibhav Bajaj
 

Destaque (13)

Stroustrup c++0x overview
Stroustrup c++0x overviewStroustrup c++0x overview
Stroustrup c++0x overview
 
Mid1 Revision
Mid1  RevisionMid1  Revision
Mid1 Revision
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
Process Synchronization And Deadlocks
Process Synchronization And DeadlocksProcess Synchronization And Deadlocks
Process Synchronization And Deadlocks
 
Operating System 5
Operating System 5Operating System 5
Operating System 5
 
Unit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - ThreadsUnit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - Threads
 
Unit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process SynchronizationUnit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process Synchronization
 
Ch3 OS
Ch3 OSCh3 OS
Ch3 OS
 
Ch4 OS
Ch4 OSCh4 OS
Ch4 OS
 
Ch2 OS
Ch2 OSCh2 OS
Ch2 OS
 
Chapter 9 OS
Chapter 9 OSChapter 9 OS
Chapter 9 OS
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
 
Operating system.ppt (1)
Operating system.ppt (1)Operating system.ppt (1)
Operating system.ppt (1)
 

Semelhante a Tutorial4 Threads

Threads Advance in System Administration with Linux
Threads Advance in System Administration with LinuxThreads Advance in System Administration with Linux
Threads Advance in System Administration with LinuxSoumen Santra
 
Chapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYA
Chapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYAChapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYA
Chapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYAMaulik Borsaniya
 
ch 7 POSIX.pptx
ch 7 POSIX.pptxch 7 POSIX.pptx
ch 7 POSIX.pptxsibokac
 
Parallel program design
Parallel program designParallel program design
Parallel program designZongYing Lyu
 
OpenHPI - Parallel Programming Concepts - Week 3
OpenHPI - Parallel Programming Concepts - Week 3OpenHPI - Parallel Programming Concepts - Week 3
OpenHPI - Parallel Programming Concepts - Week 3Peter Tröger
 
Basic Multithreading using Posix Threads
Basic Multithreading using Posix ThreadsBasic Multithreading using Posix Threads
Basic Multithreading using Posix ThreadsTushar B Kute
 
Modify this code to use multiple threads with the same data1.Modif.pdf
Modify this code to use multiple threads with the same data1.Modif.pdfModify this code to use multiple threads with the same data1.Modif.pdf
Modify this code to use multiple threads with the same data1.Modif.pdfmallik3000
 
Understanding Threads in operating system
Understanding Threads in operating systemUnderstanding Threads in operating system
Understanding Threads in operating systemHarrytoye2
 
Python scripting kick off
Python scripting kick offPython scripting kick off
Python scripting kick offAndrea Gangemi
 
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbsSystem Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbsashukiller7
 

Semelhante a Tutorial4 Threads (20)

P threads
P threadsP threads
P threads
 
Threads Advance in System Administration with Linux
Threads Advance in System Administration with LinuxThreads Advance in System Administration with Linux
Threads Advance in System Administration with Linux
 
PDCCLECTUREE.pptx
PDCCLECTUREE.pptxPDCCLECTUREE.pptx
PDCCLECTUREE.pptx
 
Threads
ThreadsThreads
Threads
 
Chapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYA
Chapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYAChapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYA
Chapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYA
 
ch 7 POSIX.pptx
ch 7 POSIX.pptxch 7 POSIX.pptx
ch 7 POSIX.pptx
 
Parallel program design
Parallel program designParallel program design
Parallel program design
 
Sysprog 14
Sysprog 14Sysprog 14
Sysprog 14
 
OpenHPI - Parallel Programming Concepts - Week 3
OpenHPI - Parallel Programming Concepts - Week 3OpenHPI - Parallel Programming Concepts - Week 3
OpenHPI - Parallel Programming Concepts - Week 3
 
Basic Multithreading using Posix Threads
Basic Multithreading using Posix ThreadsBasic Multithreading using Posix Threads
Basic Multithreading using Posix Threads
 
Chap7 slides
Chap7 slidesChap7 slides
Chap7 slides
 
posix.pdf
posix.pdfposix.pdf
posix.pdf
 
Modify this code to use multiple threads with the same data1.Modif.pdf
Modify this code to use multiple threads with the same data1.Modif.pdfModify this code to use multiple threads with the same data1.Modif.pdf
Modify this code to use multiple threads with the same data1.Modif.pdf
 
Understanding Threads in operating system
Understanding Threads in operating systemUnderstanding Threads in operating system
Understanding Threads in operating system
 
Intake 38 12
Intake 38 12Intake 38 12
Intake 38 12
 
Threading
ThreadingThreading
Threading
 
Python scripting kick off
Python scripting kick offPython scripting kick off
Python scripting kick off
 
Threads
ThreadsThreads
Threads
 
Microkernel Development
Microkernel DevelopmentMicrokernel Development
Microkernel Development
 
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbsSystem Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
 

Mais de tech2click

Mais de tech2click (10)

Ch13
Ch13Ch13
Ch13
 
Ch12
Ch12Ch12
Ch12
 
Ch11
Ch11Ch11
Ch11
 
Ch10
Ch10Ch10
Ch10
 
Ch8
Ch8Ch8
Ch8
 
Operating System 4
Operating System 4Operating System 4
Operating System 4
 
Operating System 3
Operating System 3Operating System 3
Operating System 3
 
Tutorial 2
Tutorial 2Tutorial 2
Tutorial 2
 
Operating System 2
Operating System 2Operating System 2
Operating System 2
 
Rootkit
RootkitRootkit
Rootkit
 

Tutorial4 Threads