In Java concurrency, what makes a thread "active"? Just the fact that it's not idling? Is a "waiting" or "suspended" thread still considered, technically, active?
From what I can tell the term 'active' seems to be used a lot but not ever defined. The ThreadGroup.enumerate()
method is documented to:
Copies into the specified array every active thread in this thread group and its subgroups.
and from looking at the source for this, it is checking the Thread.isAlive()
method and adding those to the enumerable. From this I deduce that the terms 'active' and 'alive' are interchangeable and 'alive' is defined as:
A thread is alive if it has been started and has not yet died.
Take a look at java.lang.Thread.State
In other non Java systems, active equates to "RUNNABLE". A Task/Process/Thread is active if it is able to actively run code. It is suspended if it is not (blocking, etc.)
As Stephen C said, active is being used more as English rather then Java here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With