Multithreading - Can there be zombie threads in a java program Stack Overflow

Can there be zombie threads in a java program?

Now I have that ability. In fact, the moment the scheduler returns, it switches to the main, and the main block ends. What actually happens in the stream that created the start method? The abandoned no n-hemonal stream (what we created) remains means that the program continues to be executed or has the option to freeze zombie streams (this is not yet well understood. ) Which is the possibility of actually happening (or what is the "possibility" that cannot be accessed in sync)? Edit: This question can be paraphrased as "what is preparing only the Start () method call?" For more information, read the website: Why call the Thread. start () method?

Set 4 November 2023 21:27 2 132 3 3 3 Gold icon 18 18 Silver icon 49, 49 Bronze icon

From the thread (docs. Oracle. com): "Platform stream is classified as jet, daemon, or no n-demon. When starting a Java virtual machine, a no n-stream (usually important, important, important. The order of the application method is the end of the unstable no n-sealed jet.

Comments on November 4, 2023 21:34 And for the integrity of the image: Shutdown order (docs.) Commented on 4 November 2023 at 21:36

I am still a beginner in the Java mult i-application world. I do not know the text of what was written there: (In fact, I still put it in front of it means that JVM ends at the first execution of the third standard. 。

Comments on November 4, 2023 21:39

Simply put, JVM waits for all running jets that are not devils and start the end order. For some reason, if the abandoned stream needs to be left, it ends.

Comments on November 4, 2023 21:41 So either stream. Comment on November 4, 2023 at 21:42

2 Answers 2

TL;DR

In your case, the stream is launched and the JVM is not off until the stream is still over (if another end event is not triggered). Therefore, no additional synchronization is required.

longer description

Start streaming in your own main method. The Start () method ends until the header method stops, so the application is not disabled. As mentioned in your comments (and in your question), JVM does not work because all the devils are stopped.

When you create a stream, it's in threadState. New state, but as soon as you call Start() it goes into ThreadState. Runnable (or close to it if it's already done some work) and stops completing the request.

Thread t = new Thread (()-& amp; amp; gt;); T. start (); System. out. println (t. getState ());< //you can do something here if you want to >If the stream is neither new nor finished, it's alive, so it will prevent the JVM from completing. 

So the second stream will run until it's finished or something is still stopped by the JVM.

Once you call thread#start, you'll have a stream that will prevent the JVM from completing, regardless of whether it actually started running or not.

But as mentioned in the comments, everything can be different if thread#start is called after stopping the last slow stream. If the JVM is already shut down, the thread#Start call won't cancel the shutdown on another stream.

If the last non-sealed stream is stopped and a daemon stream tries to start a non-sealed stream "at the same time", a race condition can occur and the stream may win or stop. If the stream was actually marked as started before the last (non-sealed) stream was stopped, it will behave normally and the JVM will not shut down. But if the JVM determines that all streams have stopped before the new stream is marked as ignored (runnable), the JVM will start the termination sequence and will terminate the newly started stream after all termination tasks have completed.

When using virtual streams, keep in mind that they are always daemon streams.

avatar-logo

Elim Rim - Journalist, creative writer

Last modified 27.09.2024

I have multiple classes and I use constructors between them ALOT. This is my first time coming across a stack overflow error. I have a system with a Zombie process (python3 running multiple threads) which has many threads. The problem is, the application htop gets stuck in. Arguably, using a single object for the multiple threads could be faster, as the memory for that object could get cached.

Play for real with EXCLUSIVE BONUSES
Play
enaccepted