SlideShare a Scribd company logo
Core Java

Debasish Pratihari

Thread


A thread is the basic unit to which the operating
system allocates processor time.



Threads are useful to execute more or less
independent code segments concurrently of a
program.



Is knows as light-weight process.



Threads are always owned and managed by
operating system.



Every program has at least one thread.

User Thread


A user thread has a life-time of its own.



It is not depended on the thread that creates it.



It can continue execution after the thread that
created has ended.

Daemon Thread


Is a background thread that sub-ordinate to the
thread that creates it



When the thread that created the daemon
thread ends, the daemon thread dies with it.



A thread can be set to daemon before it starts



Threads

created

from

daemon

thread

are

daemon by default.

Lecture/core/thread1/20

Page #1

feel the Technology…
Core Java

Debasish Pratihari

Process


It has its own address space.



A process can’t access another process’s
memory .



Each process provides the resources needed to
execute a program.



Threads belongs to same process shares same
address space.



A process has at least one thread of execution.

Thread Objects:


Each thread is associated with an instance of
the class Thread



There are two ways for using thread object
 Directly controlling thread
 Using executor

Creating Thread
 Provide a Runnable Object
class Lakshya implements Runnable{
--}


Sub class Thread
class Lakshya extends Thread{
--}

Lecture/core/thread1/20

Page #2

feel the Technology…
Core Java

Debasish Pratihari

Thread State:


New Born State: When we create a Thread
Object then a Thread is born.



Runnable State: When we call the start( )
method on a thread then thread is in the
Runnable state i.e., the threads in Runnable
state are all waiting in a queue for the
availability of CPU attention or their turns to
come.



Running State: When a thread got the time of
CPU then it starts execution for a particular
interval of time (time slice) this state is called as
Running state.



Blocked state: A thread is in the blocked state
when it is prevented to entered into Runnable
state.



Dead state: This is the end of life of a thread,
when a thread completes execution comes to
the dead state. Also we can dead state by
calling stop( ) method.

New
Born

Start ( )

sleep ( )

Runnable
State

Stop ( )
Scheduling

Dead
State

Lecture/core/thread1/20

Running
State

Block
State
after time-slice
or
yield( )

Page #3

feel the Technology…
Core Java


Debasish Pratihari

A Thread enters into blocked state under the
following situation.






By sleeping a thread.
If a thread is waiting for I/O operation.
If a thread is Interrupted.
If a thread is waiting for lock available.

Thread Life-Cycle
25%
New
Born
start( )

start ( )
notify( )/ notifyAll ( )

Runnable
State

wait lock available
I/O complete
after t time

Scheduling
mechanism

after time
slice
sleep( )
wait( )

Running
State

wait for Lock
wait for I/O
sleep( t )

B
L
O
C
K
E
D
S
T
A
T
E

Dead
State

Lecture/core/thread1/20

Page #4

feel the Technology…

More Related Content

What's hot

Java Multithreading
Java MultithreadingJava Multithreading
Java Multithreading
Rajkattamuri
 
Thread presentation
Thread presentationThread presentation
Thread presentation
AAshish Ojha
 
Java Threads
Java ThreadsJava Threads
Java Threads
M Vishnuvardhan Reddy
 
Life cycle-of-a-thread
Life cycle-of-a-threadLife cycle-of-a-thread
Life cycle-of-a-thread
javaicon
 
Thread model in java
Thread model in javaThread model in java
Thread model in java
AmbigaMurugesan
 
Threads concept in java
Threads concept in javaThreads concept in java
Threads concept in java
Muthukumaran Subramanian
 
Intro To .Net Threads
Intro To .Net ThreadsIntro To .Net Threads
Intro To .Net Threads
rchakra
 
Multithreading
MultithreadingMultithreading
Multithreadingbackdoor
 
Multithread Programing in Java
Multithread Programing in JavaMultithread Programing in Java
Multithread Programing in Java
M. Raihan
 
Multithreading in-java
Multithreading in-javaMultithreading in-java
Multithreading in-java
aalipalh
 
Java Thread & Multithreading
Java Thread & MultithreadingJava Thread & Multithreading
Java Thread & Multithreading
jehan1987
 
Basic of Multithreading in JAva
Basic of Multithreading in JAvaBasic of Multithreading in JAva
Basic of Multithreading in JAva
suraj pandey
 
Developing Multithreaded Applications
Developing Multithreaded ApplicationsDeveloping Multithreaded Applications
Developing Multithreaded ApplicationsBharat17485
 
Java threading
Java threadingJava threading
Java threading
Chinh Ngo Nguyen
 
Threads in Java
Threads in JavaThreads in Java
Threads in Java
HarshaDokula
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Javaparag
 
Java thread
Java threadJava thread
Java thread
Arati Gadgil
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
junnubabu
 

What's hot (19)

Java Multithreading
Java MultithreadingJava Multithreading
Java Multithreading
 
Thread presentation
Thread presentationThread presentation
Thread presentation
 
Java Threads
Java ThreadsJava Threads
Java Threads
 
Life cycle-of-a-thread
Life cycle-of-a-threadLife cycle-of-a-thread
Life cycle-of-a-thread
 
Thread model in java
Thread model in javaThread model in java
Thread model in java
 
Threads concept in java
Threads concept in javaThreads concept in java
Threads concept in java
 
Intro To .Net Threads
Intro To .Net ThreadsIntro To .Net Threads
Intro To .Net Threads
 
Multithreading
MultithreadingMultithreading
Multithreading
 
Multithread Programing in Java
Multithread Programing in JavaMultithread Programing in Java
Multithread Programing in Java
 
Multithreading in-java
Multithreading in-javaMultithreading in-java
Multithreading in-java
 
Java Thread & Multithreading
Java Thread & MultithreadingJava Thread & Multithreading
Java Thread & Multithreading
 
Basic of Multithreading in JAva
Basic of Multithreading in JAvaBasic of Multithreading in JAva
Basic of Multithreading in JAva
 
Developing Multithreaded Applications
Developing Multithreaded ApplicationsDeveloping Multithreaded Applications
Developing Multithreaded Applications
 
Java threading
Java threadingJava threading
Java threading
 
Threads in Java
Threads in JavaThreads in Java
Threads in Java
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Java
 
Multithreading Concepts
Multithreading ConceptsMultithreading Concepts
Multithreading Concepts
 
Java thread
Java threadJava thread
Java thread
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 

Viewers also liked

Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
Prakhar Maurya
 
Chapter 2: Operating System Structures
Chapter 2: Operating System StructuresChapter 2: Operating System Structures
Chapter 2: Operating System Structures
Shafaan Khaliq Bhatti
 
Coral Exodo - 06.05.07
Coral Exodo - 06.05.07Coral Exodo - 06.05.07
Coral Exodo - 06.05.07Jubrac Jacui
 
Presentatie Starterslift Breda - Online marketing
Presentatie Starterslift Breda - Online marketingPresentatie Starterslift Breda - Online marketing
Presentatie Starterslift Breda - Online marketing
Sjef Kerkhofs
 
Codemotion twitter programming
Codemotion twitter programmingCodemotion twitter programming
Codemotion twitter programming
Matteo Baccan
 
JIPDay 2005: Xlet Java Programming
JIPDay 2005: Xlet Java ProgrammingJIPDay 2005: Xlet Java Programming
JIPDay 2005: Xlet Java Programming
Matteo Baccan
 
小企业金融业务品牌推广方案 Push(v4.0)
小企业金融业务品牌推广方案 Push(v4.0)小企业金融业务品牌推广方案 Push(v4.0)
小企业金融业务品牌推广方案 Push(v4.0)
Push ,Beijing
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
Debasish Pratihari
 
Migration Intro
Migration IntroMigration Intro
Migration Introdazza50
 
Clive Shepherd at LP2010
Clive Shepherd at LP2010Clive Shepherd at LP2010
Clive Shepherd at LP2010
Paul McElvaney
 
Joanne jacobs at LP2010
Joanne jacobs at LP2010Joanne jacobs at LP2010
Joanne jacobs at LP2010
Paul McElvaney
 
Scenario exercise 2014 mid atlantic technical communication conference DDeBoard
Scenario exercise 2014 mid atlantic technical communication conference DDeBoardScenario exercise 2014 mid atlantic technical communication conference DDeBoard
Scenario exercise 2014 mid atlantic technical communication conference DDeBoard
ddeboard
 
Developing Policy for Emerging Technologies
Developing Policy for Emerging TechnologiesDeveloping Policy for Emerging Technologies
Developing Policy for Emerging Technologies
Lovisa Williams
 
Pattern Learning
Pattern LearningPattern Learning
Pattern Learning
jbetter
 
KDE: a solution for business environments
KDE: a solution for business environmentsKDE: a solution for business environments
KDE: a solution for business environments
Agustin Benito Bethencourt
 
維基經濟學
維基經濟學維基經濟學
維基經濟學sdfvb
 
Mobile Tv
Mobile TvMobile Tv
Mobile Tv
Udi Salant
 
Culto De Ferias - 26.07.07
Culto De Ferias - 26.07.07Culto De Ferias - 26.07.07
Culto De Ferias - 26.07.07Jubrac Jacui
 

Viewers also liked (20)

Ch4 Threads
Ch4 ThreadsCh4 Threads
Ch4 Threads
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
 
Chapter 2: Operating System Structures
Chapter 2: Operating System StructuresChapter 2: Operating System Structures
Chapter 2: Operating System Structures
 
Coral Exodo - 06.05.07
Coral Exodo - 06.05.07Coral Exodo - 06.05.07
Coral Exodo - 06.05.07
 
Presentatie Starterslift Breda - Online marketing
Presentatie Starterslift Breda - Online marketingPresentatie Starterslift Breda - Online marketing
Presentatie Starterslift Breda - Online marketing
 
Codemotion twitter programming
Codemotion twitter programmingCodemotion twitter programming
Codemotion twitter programming
 
JIPDay 2005: Xlet Java Programming
JIPDay 2005: Xlet Java ProgrammingJIPDay 2005: Xlet Java Programming
JIPDay 2005: Xlet Java Programming
 
小企业金融业务品牌推广方案 Push(v4.0)
小企业金融业务品牌推广方案 Push(v4.0)小企业金融业务品牌推广方案 Push(v4.0)
小企业金融业务品牌推广方案 Push(v4.0)
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Migration Intro
Migration IntroMigration Intro
Migration Intro
 
Clive Shepherd at LP2010
Clive Shepherd at LP2010Clive Shepherd at LP2010
Clive Shepherd at LP2010
 
Joanne jacobs at LP2010
Joanne jacobs at LP2010Joanne jacobs at LP2010
Joanne jacobs at LP2010
 
280 slides
280 slides280 slides
280 slides
 
Scenario exercise 2014 mid atlantic technical communication conference DDeBoard
Scenario exercise 2014 mid atlantic technical communication conference DDeBoardScenario exercise 2014 mid atlantic technical communication conference DDeBoard
Scenario exercise 2014 mid atlantic technical communication conference DDeBoard
 
Developing Policy for Emerging Technologies
Developing Policy for Emerging TechnologiesDeveloping Policy for Emerging Technologies
Developing Policy for Emerging Technologies
 
Pattern Learning
Pattern LearningPattern Learning
Pattern Learning
 
KDE: a solution for business environments
KDE: a solution for business environmentsKDE: a solution for business environments
KDE: a solution for business environments
 
維基經濟學
維基經濟學維基經濟學
維基經濟學
 
Mobile Tv
Mobile TvMobile Tv
Mobile Tv
 
Culto De Ferias - 26.07.07
Culto De Ferias - 26.07.07Culto De Ferias - 26.07.07
Culto De Ferias - 26.07.07
 

Similar to Lecture 20

Slide 7 Thread-1.pptx
Slide 7 Thread-1.pptxSlide 7 Thread-1.pptx
Slide 7 Thread-1.pptx
ajmalhamidi1380
 
Threading concepts
Threading conceptsThreading concepts
Threading concepts
Raheemaparveen
 
econtent thread in java.pptx
econtent thread in java.pptxecontent thread in java.pptx
econtent thread in java.pptx
ramyan49
 
Multithreading Introduction and Lifecyle of thread
Multithreading Introduction and Lifecyle of threadMultithreading Introduction and Lifecyle of thread
Multithreading Introduction and Lifecyle of thread
Kartik Dube
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
JanmejayaPadhiary2
 
Java Threads
Java ThreadsJava Threads
Java Threads
Hamid Ghorbani
 
Multithreading
MultithreadingMultithreading
Multithreadingsagsharma
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
Monika Mishra
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
VINOTH R
 
Multithreading programming in java
Multithreading programming in javaMultithreading programming in java
Multithreading programming in java
Elizabeth alexander
 
Java
JavaJava
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
Kavitha713564
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
Kavitha713564
 
Multithreading
MultithreadingMultithreading
Multithreading
F K
 
Java
JavaJava
multithreading
multithreadingmultithreading
multithreading
Rajkattamuri
 
Java multithreading
Java multithreadingJava multithreading
Java multithreading
Mohammed625
 
Unit-3 MULTITHREADING-2.pdf
Unit-3 MULTITHREADING-2.pdfUnit-3 MULTITHREADING-2.pdf
Unit-3 MULTITHREADING-2.pdf
GouthamSoma1
 
Java unit 12
Java unit 12Java unit 12
Java unit 12
Shipra Swati
 

Similar to Lecture 20 (20)

Slide 7 Thread-1.pptx
Slide 7 Thread-1.pptxSlide 7 Thread-1.pptx
Slide 7 Thread-1.pptx
 
Threading concepts
Threading conceptsThreading concepts
Threading concepts
 
econtent thread in java.pptx
econtent thread in java.pptxecontent thread in java.pptx
econtent thread in java.pptx
 
Multithreading Introduction and Lifecyle of thread
Multithreading Introduction and Lifecyle of threadMultithreading Introduction and Lifecyle of thread
Multithreading Introduction and Lifecyle of thread
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Java Threads
Java ThreadsJava Threads
Java Threads
 
Multithreading
MultithreadingMultithreading
Multithreading
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Md09 multithreading
Md09 multithreadingMd09 multithreading
Md09 multithreading
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
 
Multithreading programming in java
Multithreading programming in javaMultithreading programming in java
Multithreading programming in java
 
Java
JavaJava
Java
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Multithreading
MultithreadingMultithreading
Multithreading
 
Java
JavaJava
Java
 
multithreading
multithreadingmultithreading
multithreading
 
Java multithreading
Java multithreadingJava multithreading
Java multithreading
 
Unit-3 MULTITHREADING-2.pdf
Unit-3 MULTITHREADING-2.pdfUnit-3 MULTITHREADING-2.pdf
Unit-3 MULTITHREADING-2.pdf
 
Java unit 12
Java unit 12Java unit 12
Java unit 12
 

More from Debasish Pratihari

Lecture 24
Lecture 24Lecture 24
Lecture 24
Debasish Pratihari
 
Lecture 23
Lecture 23Lecture 23
Lecture 23
Debasish Pratihari
 
Lecture 22
Lecture 22Lecture 22
Lecture 22
Debasish Pratihari
 
Lecture 21
Lecture 21Lecture 21
Lecture 21
Debasish Pratihari
 
Lecture 19
Lecture 19Lecture 19
Lecture 19
Debasish Pratihari
 
Lecture 17
Lecture 17Lecture 17
Lecture 17
Debasish Pratihari
 
Lecture 16
Lecture 16Lecture 16
Lecture 16
Debasish Pratihari
 
Lecture 14
Lecture 14Lecture 14
Lecture 14
Debasish Pratihari
 
Lecture 10
Lecture 10Lecture 10
Lecture 10
Debasish Pratihari
 
Lecture 9
Lecture 9Lecture 9
Lecture 8
Lecture 8Lecture 8
Lecture 7
Lecture 7Lecture 7
Lecture 6
Lecture 6Lecture 6
Lecture 5
Lecture 5Lecture 5
Lecture 4
Lecture 4Lecture 4
Lecture 3
Lecture 3Lecture 3
Lecture 2
Lecture 2Lecture 2
Lecture 1
Lecture 1Lecture 1
Lecture25
Lecture25Lecture25

More from Debasish Pratihari (19)

Lecture 24
Lecture 24Lecture 24
Lecture 24
 
Lecture 23
Lecture 23Lecture 23
Lecture 23
 
Lecture 22
Lecture 22Lecture 22
Lecture 22
 
Lecture 21
Lecture 21Lecture 21
Lecture 21
 
Lecture 19
Lecture 19Lecture 19
Lecture 19
 
Lecture 17
Lecture 17Lecture 17
Lecture 17
 
Lecture 16
Lecture 16Lecture 16
Lecture 16
 
Lecture 14
Lecture 14Lecture 14
Lecture 14
 
Lecture 10
Lecture 10Lecture 10
Lecture 10
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Lecture25
Lecture25Lecture25
Lecture25
 

Recently uploaded

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 

Recently uploaded (20)

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 

Lecture 20

  • 1. Core Java Debasish Pratihari Thread  A thread is the basic unit to which the operating system allocates processor time.  Threads are useful to execute more or less independent code segments concurrently of a program.  Is knows as light-weight process.  Threads are always owned and managed by operating system.  Every program has at least one thread. User Thread  A user thread has a life-time of its own.  It is not depended on the thread that creates it.  It can continue execution after the thread that created has ended. Daemon Thread  Is a background thread that sub-ordinate to the thread that creates it  When the thread that created the daemon thread ends, the daemon thread dies with it.  A thread can be set to daemon before it starts  Threads created from daemon thread are daemon by default. Lecture/core/thread1/20 Page #1 feel the Technology…
  • 2. Core Java Debasish Pratihari Process  It has its own address space.  A process can’t access another process’s memory .  Each process provides the resources needed to execute a program.  Threads belongs to same process shares same address space.  A process has at least one thread of execution. Thread Objects:  Each thread is associated with an instance of the class Thread  There are two ways for using thread object  Directly controlling thread  Using executor Creating Thread  Provide a Runnable Object class Lakshya implements Runnable{ --}  Sub class Thread class Lakshya extends Thread{ --} Lecture/core/thread1/20 Page #2 feel the Technology…
  • 3. Core Java Debasish Pratihari Thread State:  New Born State: When we create a Thread Object then a Thread is born.  Runnable State: When we call the start( ) method on a thread then thread is in the Runnable state i.e., the threads in Runnable state are all waiting in a queue for the availability of CPU attention or their turns to come.  Running State: When a thread got the time of CPU then it starts execution for a particular interval of time (time slice) this state is called as Running state.  Blocked state: A thread is in the blocked state when it is prevented to entered into Runnable state.  Dead state: This is the end of life of a thread, when a thread completes execution comes to the dead state. Also we can dead state by calling stop( ) method. New Born Start ( ) sleep ( ) Runnable State Stop ( ) Scheduling Dead State Lecture/core/thread1/20 Running State Block State after time-slice or yield( ) Page #3 feel the Technology…
  • 4. Core Java  Debasish Pratihari A Thread enters into blocked state under the following situation.     By sleeping a thread. If a thread is waiting for I/O operation. If a thread is Interrupted. If a thread is waiting for lock available. Thread Life-Cycle 25% New Born start( ) start ( ) notify( )/ notifyAll ( ) Runnable State wait lock available I/O complete after t time Scheduling mechanism after time slice sleep( ) wait( ) Running State wait for Lock wait for I/O sleep( t ) B L O C K E D S T A T E Dead State Lecture/core/thread1/20 Page #4 feel the Technology…