answersLogoWhite

0

Thread exists in several states. A thread just created is in the born state. When the threads start

method is called, it enters the runnable (ready) state. Then the system assigns a processor to the thread.

A thread enters the dead state when its run method completes or terminates for any reason. When a sleep

method is called in a running thread, that thread becomes ready after the designated sleep time expires.

Even if a processor is available, sleeping thread can not use it.

A running thread can enter a blocked state.

User Avatar

Wiki User

14y ago

What else can I help you with?

Continue Learning about Engineering

Describe the program development cycle and explain why it is called a cycle?

Design (write down how it should work), Implement (create some code), Test (make sure it works), Deploy (send it to the users), Maintain (fix bugs). Note that depending on the methodology, these steps may occur very rapidly, or slowly, or bounce back and forth, or go in a full circle over and again.


Life cycle of thread in java?

# New state - After the creations of Thread instance the thread is in this state but before the start() method invocation. At this point, the thread is considered not alive.# Runnable (Ready-to-run) state - A thread start its life from Runnable state. A thread first enters runnable state after the invoking of start() method but a thread can return to this state after either running, waiting, sleeping or coming back from blocked state also. On this state a thread is waiting for a turn on processor. # Running state - A thread is in running state that means the thread is currently executing. There are several ways to enter in Runnable state but there is only one way to enter in Running state: the scheduler select a thread from runnable pool.# Dead state - A thread can be considered dead when its run() method completes. If any thread comes on this state that means it cannot ever run again. # Blocked - A thread can enter in this state because of waiting the resources that are hold by another thread.


How would you describe the fetch execute cycle?

Fetch Execute Cycle A more complete form of the Instruction Fetch Execute Cycle can be broken down into the following steps: 1. Fetch Cycle 2. Decode Cycle 3. Execute Cycle 4. Interrupt Cycle 1. Fetch Cycle The fetch cycle begins with retrieving the address stored in the Program Counter (PC). The address stored in the PC is some valid address in the memory holding the instruction to be executed. (In case this address does not exist we would end up causing an interrupt or exception).The Central Processing Unit completes this step by fetching the instruction stored at this address from the memory and transferring this instruction to a special register - Instruction Register (IR) to hold the instruction to be executed. The program counter is incremented to point to the next address from which the new instruction is to be fetched. 2. Decode Cycle The decode cycle is used for interpreting the instruction that was fetched in the Fetch Cycle. The operands are retrieved from the addresses if the need be. 3. Execute Cycle This cycle as the name suggests, simply executes the instruction that was fetched and decoded


Difference between Carnot and ideal cycle?

What is the difference between ideal and actual cycle?


Why you use cut-off ratio in diesel cycle not in Otto cycle?

We use cut-off ratio in diesel cycle and not in Otto cycle because it is cost effective.

Related Questions

How you would achieve multithreading in java?

Java provides built-in support for multithreaded programming. A multithreaded program contains two or more parts that can run concurrently. Each part of such a program is called a thread, and each thread defines a separate path of execution.A multithreading is a specialized form of multitasking. Multitasking threads require less overhead than multitasking processes.We achieve multithreading in Java by following this steps...New: A new thread begins its life cycle in the new state. It remains in this state until the program starts the thread. It is also referred to as a born thread.Runnable: After a newly born thread is started, the thread becomes runnable. A thread in this state is considered to be executing its task.Waiting: Sometimes a thread transitions to the waiting state while the thread waits for another thread to perform a task. A thread transitions back to the runnable state only when another thread signals the waiting thread to continue executing.Timed waiting: A runnable thread can enter the timed waiting state for a specified interval of time. A thread in this state transitions back to the runnable state when that time interval expires or when the event it is waiting for occurs.Terminated: A runnable thread enters the terminated state when it completes its task or otherwise terminates.


Explain instruction cycle?

An instruction cycle is the rudimentary operation cycle of any computer. It involves the CPU fetching a program from memory and executing it fully.


How do you explain the model of destination life cycle?

explain the destination life cycle explain the destination life cycle


Explain the last stage in the beetle life cycle?

explain the last stage of the life cycle of a beetle


About a threads life cycle?

A Thread has many states in its life cycle. 1. Active - When you create a new thread 2. Running - When you invoke the thread.start() method 3. Waiting - When it is waiting on user input or for some other thread 4. Terminated/Dead - Once it finishes execution.


Explain what is meant by the fetch-execute cycle and describe its action in RLT?

Explain what is meant by the fetch-execute cycle and describe its action in RLT?" Explain what is meant by the fetch-execute cycle and describe its action in RLT?"


Explain the communication cycle with respect to an organisation?

how communication cycle in an organisation


Describe the Life cycle of a thread in java.?

Life cycle of a thread New: when a thread is not yet initialized, it is in New state Runnable or Ready : Once the thread is initialized and its start method is called, then the thread becomes ready for execution, which is otherwise called runnable or ready state Not Runnable : When a thread is asked to sleep for some time or wait for some time by using the sleep or wait method, thread goes to Not Runnable state for the specified time. Dead state: Once the thread is executed,it turns to dead state. Hope this would answer your question. let me know if you are still not clear


Life cycle of a thread in java?

A thread can be any of the following states during its lifecyclenew - just createdrunnable - ready to runrunningwaiting/blocked - waiting for some operationdead


What is the role of needs in business cycle?

explain the role of needs in the business cycle


What do you mean by multithreaded program and Explain the life cycle of a thread?

In a single-threaded runtime environment, actions execute one after another. The next action can happen only when the previous one is finished. If task A takes half an hour, and the user wants to do something else, he is doomed to wait until task A is over.Ideally, the user should be able to carry on with his other task until his first task is complete. Imagine having to wait till your eclipse build all your source code before you could check your email? Thankfully windows uses multiple threads to run your eclipse and outlook. So you don't have to go through this pain. Similarly java has options wherein the programmer can have multiple threads of execution running. The program that does what is explained above would be a multithreaded program.Thread StatesA thread can be only in one of five states• New - This is the state the thread is in after the Thread instance has been created, but the start() method has not been invoked on the thread. It is a live Thread object, but not yet a thread of execution. At this point, the thread is considered not alive.• Runnable - This is the state a thread is in when it's eligible to run, but the scheduler has not selected it to be the running thread. A thread first enters the runnable state when the start() method is invoked, but a thread can also return to the runnable state after either running or coming back from a blocked, waiting, or sleeping state. When the thread is in the runnable state, it is considered alive.• Running - This is where all the action is. This is the state a thread is in when the thread scheduler selects it (from the runnable pool) to be the currently executing process. A thread can transition out of a running state for several reasons, including because "the thread scheduler felt like it." We'll look at those other reasons shortly. There are several ways to get to the runnable state, but only one way to get to the running state: the scheduler chooses a thread from the runnable pool.• Waiting/blocked/sleeping - This is the state a thread is in when it's not eligible to run. Okay, so this is really three states combined into one, but they all have one thing in common: the thread is still alive, but is currently not eligible to run. In other words, it is not runnable, but it might return to a runnable state later if a particular event occurs. A thread may be blocked waiting for a resource (like I/O or an object's lock), in which case the event that sends it back to runnable is the availability of the resource-for example, if data comes in through the input stream the thread code is reading from, or if the object's lock suddenly becomes available. A thread may be sleeping because the thread's run code tells it to sleep for some period of time, in which case the event that sends it back to runnable is that it wakes up because its sleep time has expired. Or the thread may be waiting, because the thread's run code causes it to wait, in which case the event that sends it back to runnable is that another thread sends a notification that it may no longer be necessary for the thread to wait. The important point is that one thread does not tell another thread to block. Some methods may look like they tell another thread to block, but they don't. If you have a reference t to another thread, you can write something like this:t.sleep() or t.yield()But those are actually static methods of the Thread class-they don't affect the instance t; instead they are defined to always affect the thread that's currently executing. There is also a stop() method, but it too has been deprecated and we won't even go there. Both suspend() and stop() turned out to be very dangerous, so you shouldn't use them and again, because they're deprecated, they won't appear on the exam. Don't study them, most importantly don't use them. Note also that a thread in a blocked state is still considered to be alive.• Dead - A thread is considered dead when its run() method completes. It may still be a viable Thread object, but it is no longer a separate thread of execution. Once a thread is dead, it can never be brought back to life! (The whole "I see dead threads" thing.) If you invoke start() on a dead Thread instance, you'll get a runtime (not compiler) exception. And it probably doesn't take a rocket scientist to tell you that if a thread is dead, it is no longer considered to be alive.


What is the meaning of the thread of araidne?

the thread of life in Greek myth of the three sisters one makes the string one pulls the string and one cuts the string that is the cycle of life.