Should the stream setting in the daemon stream be changed?

I understand the difference between a daemon thread and a regular thread. When called setDaemon(true), the thread will be marked so that it does not support the JVM. The JVM will automatically shut down if there are no non-daemon threads. When you start the JVM, only the main thread is a non-daemon thread.

I also understand that thread priority can be set regardless of this. By invoking setPriority(Thread.MAX_PRIORITY), the thread will be configured so that the maximum scheduling priority is resolved by its thread group. I feel that I understand these concepts well.

My question is: is there anything inherent in the flow of the demon that will reduce its priority? or is it just a flag saying “you don’t have to wait for me to turn off the JVM”?

I work with a thread in a shared library that cannot be disabled through the API. I asked that this thread be flagged as a daemon thread, but the owner is concerned that this will reduce its priority in the scheduler. It seems to me that since priority is controlled separately from the daemon flow designation, it should be orthogonal. However, it’s hard for me to find documentation about this.

+4
source share

Source: https://habr.com/ru/post/1607898/


All Articles