Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

ITS THREAD JAVA CLASS NOTES

Rating
-
Sold
-
Pages
4
Uploaded on
28-06-2024
Written in
2023/2024

ITS A JAVA CLASS NOTES ABOUT THE TOPIC THREAD

Institution
Course

Content preview

THREAD IN JAVA

Life Cycle of a Thread
A thread in Java can be in one of the following states:

1. New
2. Runnable
3. Running
4. Blocked
5. Waiting
6. Timed Waiting
7. Terminated

New

 A newly created thread that has not yet started execution.
 Remains in this state until the program starts the thread using the start() method.
 Also referred to as a born thread.

Runnable

 Indicates that the thread is ready for execution and waiting for the availability of the
processor.
 If all threads in the queue have the same priority, they are given time slots for
execution in a round-robin fashion.

Running

 The processor has allocated time to the thread for execution.
 A thread remains running until one of the following conditions occurs:
o The thread gives up its control voluntarily:
 By being suspended using the suspend() method, which can only be
revived using the resume() method.
 By being put to sleep for a specified period using the sleep(time)
method, where time is specified in milliseconds.
 By waiting for some event to occur using the wait() method. In this
case, the thread can be scheduled to run again using the notify()
method.
o The thread is pre-empted by a higher priority thread.

Blocked

 The thread is prevented from entering the runnable state or is waiting for I/O to
complete.
 A thread in this state cannot continue its execution until it is moved to the runnable
state.

Written for

Course

Document information

Uploaded on
June 28, 2024
Number of pages
4
Written in
2023/2024
Type
Class notes
Professor(s)
John
Contains
Java

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
manjoori87

Get to know the seller

Seller avatar
manjoori87 R.M.K ENGINEERING COLLEGE
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
2
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions