SlideShare una empresa de Scribd logo
1 de 9
Threads
    Melick R. Baranasooriya
http://melick-rajee.blogspot.com/
Thread
O Operating systems
  O separate the different applications
  O operating system allocates processor time


O Thread maintains
  O exception handlers
  O a scheduling priority
When to use ?
O Rich user experience
O Divide the Work load


O Communicate over
  O network
  O Web server
  O database
When to use ? ..
O Operations that take a large amount of
  time
O Distinguish tasks
  O high-priority
  O manages time-critical tasks
  O low-priority thread


O May consume memory (< than few)
Simple Example
Thread Operations


Abort()
                         Sleep()
                Join()


                           WaitOne()


  Interrupt()
Cross Thread Operations
O GUI is running in a separate thread
O If we use threads
  O It is running in separate Thread
Thread Safe Operations
O Lock




O Mutex
O Semaphore
  O Limits the number of threads that can access a
    resource
O Monitor
Thank You!

Más contenido relacionado

La actualidad más candente

Thread scheduling in Operating Systems
Thread scheduling in Operating SystemsThread scheduling in Operating Systems
Thread scheduling in Operating Systems
Nitish Gulati
 
Operating System 4
Operating System 4Operating System 4
Operating System 4
tech2click
 
Operating System-Threads-Galvin
Operating System-Threads-GalvinOperating System-Threads-Galvin
Operating System-Threads-Galvin
Sonali Chauhan
 
Multithreading models.ppt
Multithreading models.pptMultithreading models.ppt
Multithreading models.ppt
Luis Goldster
 
Multithreading models
Multithreading modelsMultithreading models
Multithreading models
anoopkrishna2
 

La actualidad más candente (20)

threads and its types ....in operating system ..
threads and its types ....in operating system ..threads and its types ....in operating system ..
threads and its types ....in operating system ..
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
 
Thread scheduling in Operating Systems
Thread scheduling in Operating SystemsThread scheduling in Operating Systems
Thread scheduling in Operating Systems
 
Operating System 4
Operating System 4Operating System 4
Operating System 4
 
Threads
ThreadsThreads
Threads
 
Operating System-Threads-Galvin
Operating System-Threads-GalvinOperating System-Threads-Galvin
Operating System-Threads-Galvin
 
OS_Ch5
OS_Ch5OS_Ch5
OS_Ch5
 
4 threads
4 threads4 threads
4 threads
 
Ch4 Threads
Ch4 ThreadsCh4 Threads
Ch4 Threads
 
Thread management
Thread management Thread management
Thread management
 
Os Threads
Os ThreadsOs Threads
Os Threads
 
Multithreading models.ppt
Multithreading models.pptMultithreading models.ppt
Multithreading models.ppt
 
Multithreading models
Multithreading modelsMultithreading models
Multithreading models
 
Multithreading
Multithreading Multithreading
Multithreading
 
Lecture 3 threads
Lecture 3   threadsLecture 3   threads
Lecture 3 threads
 
Operating System Chapter 4 Multithreaded programming
Operating System Chapter 4 Multithreaded programmingOperating System Chapter 4 Multithreaded programming
Operating System Chapter 4 Multithreaded programming
 
Multi threading models
Multi threading modelsMulti threading models
Multi threading models
 
Thread presentation
Thread presentationThread presentation
Thread presentation
 
Operating Systems 1 (7/12) - Threads
Operating Systems 1 (7/12) - ThreadsOperating Systems 1 (7/12) - Threads
Operating Systems 1 (7/12) - Threads
 
Chapter 4 - Threads
Chapter 4 - ThreadsChapter 4 - Threads
Chapter 4 - Threads
 

Destacado

Galvin-operating System(Ch8)
Galvin-operating System(Ch8)Galvin-operating System(Ch8)
Galvin-operating System(Ch8)
dsuyal1
 
Lecture5
Lecture5Lecture5
Lecture5
jntu
 

Destacado (20)

Reflection
ReflectionReflection
Reflection
 
Info path advanced development @ Sri Lanka SharePoint Forum
Info path advanced development @ Sri Lanka SharePoint ForumInfo path advanced development @ Sri Lanka SharePoint Forum
Info path advanced development @ Sri Lanka SharePoint Forum
 
Conventions & Best Practices
Conventions & Best PracticesConventions & Best Practices
Conventions & Best Practices
 
Lambda expressions
Lambda expressionsLambda expressions
Lambda expressions
 
Apps for SharePoint
Apps for SharePointApps for SharePoint
Apps for SharePoint
 
Oop concepts
Oop conceptsOop concepts
Oop concepts
 
JSOM and java script practices
JSOM and java script practicesJSOM and java script practices
JSOM and java script practices
 
App deployment
App deploymentApp deployment
App deployment
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
 
Share point developement Introduction for students
Share point developement Introduction for studentsShare point developement Introduction for students
Share point developement Introduction for students
 
Apps for SharePoint 2013
Apps for SharePoint 2013Apps for SharePoint 2013
Apps for SharePoint 2013
 
SharePoint 2013 variations feature
SharePoint 2013 variations featureSharePoint 2013 variations feature
SharePoint 2013 variations feature
 
Deadlock
DeadlockDeadlock
Deadlock
 
Java Threading
Java ThreadingJava Threading
Java Threading
 
thread-clustering
thread-clusteringthread-clustering
thread-clustering
 
Infopath controls
Infopath controlsInfopath controls
Infopath controls
 
Galvin-operating System(Ch8)
Galvin-operating System(Ch8)Galvin-operating System(Ch8)
Galvin-operating System(Ch8)
 
Ch05
Ch05Ch05
Ch05
 
Lecture5
Lecture5Lecture5
Lecture5
 
C++ Actor Model - You’ve Got Mail ...
C++ Actor Model - You’ve Got Mail ...C++ Actor Model - You’ve Got Mail ...
C++ Actor Model - You’ve Got Mail ...
 

Similar a Threading

Thread Dump Analysis
Thread Dump AnalysisThread Dump Analysis
Thread Dump Analysis
Dmitry Buzdin
 
Scalable Apache for Beginners
Scalable Apache for BeginnersScalable Apache for Beginners
Scalable Apache for Beginners
webhostingguy
 

Similar a Threading (20)

Multithreading 101
Multithreading 101Multithreading 101
Multithreading 101
 
Threads
ThreadsThreads
Threads
 
Thread Dump Analysis
Thread Dump AnalysisThread Dump Analysis
Thread Dump Analysis
 
The Windows Scheduler
The Windows SchedulerThe Windows Scheduler
The Windows Scheduler
 
Threads and processes
Threads and processesThreads and processes
Threads and processes
 
Scalable Apache for Beginners
Scalable Apache for BeginnersScalable Apache for Beginners
Scalable Apache for Beginners
 
Threading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyondThreading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyond
 
Ruby Concurrency
Ruby ConcurrencyRuby Concurrency
Ruby Concurrency
 
FOWA Scaling The Lamp Stack Workshop
FOWA Scaling The Lamp Stack WorkshopFOWA Scaling The Lamp Stack Workshop
FOWA Scaling The Lamp Stack Workshop
 
Why Oracle Engineered systems - 2013
Why Oracle Engineered systems - 2013Why Oracle Engineered systems - 2013
Why Oracle Engineered systems - 2013
 
From I/O To RAM
From I/O To RAMFrom I/O To RAM
From I/O To RAM
 
J threads-pdf
J threads-pdfJ threads-pdf
J threads-pdf
 
Concurrent Programming with Ruby and Tuple Spaces
Concurrent Programming with Ruby and Tuple SpacesConcurrent Programming with Ruby and Tuple Spaces
Concurrent Programming with Ruby and Tuple Spaces
 
process and thread.pptx
process and thread.pptxprocess and thread.pptx
process and thread.pptx
 
Shopzilla On Concurrency
Shopzilla On ConcurrencyShopzilla On Concurrency
Shopzilla On Concurrency
 
MongoDB on Windows Azure
MongoDB on Windows AzureMongoDB on Windows Azure
MongoDB on Windows Azure
 
NodeJS ecosystem
NodeJS ecosystemNodeJS ecosystem
NodeJS ecosystem
 
In-Memory Databases, Trends and Technologies (2012)
In-Memory Databases, Trends and Technologies (2012)In-Memory Databases, Trends and Technologies (2012)
In-Memory Databases, Trends and Technologies (2012)
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tour
 
Concept of thread
Concept of threadConcept of thread
Concept of thread
 

Último

Último (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Threading

  • 1. Threads Melick R. Baranasooriya http://melick-rajee.blogspot.com/
  • 2. Thread O Operating systems O separate the different applications O operating system allocates processor time O Thread maintains O exception handlers O a scheduling priority
  • 3. When to use ? O Rich user experience O Divide the Work load O Communicate over O network O Web server O database
  • 4. When to use ? .. O Operations that take a large amount of time O Distinguish tasks O high-priority O manages time-critical tasks O low-priority thread O May consume memory (< than few)
  • 6. Thread Operations Abort() Sleep() Join() WaitOne() Interrupt()
  • 7. Cross Thread Operations O GUI is running in a separate thread O If we use threads O It is running in separate Thread
  • 8. Thread Safe Operations O Lock O Mutex O Semaphore O Limits the number of threads that can access a resource O Monitor