Do java blocked threads consume more CPU resources?

I want to ask if Java will use more CPU resources when a thread is blocked, that is, waiting to lock the monitor currently locked by another thread

I'm looking at a thread dump now. Some threads are blocked while waiting for the lock monitor. I'm not sure if they may be responsible for high CPU utilization

thank you!

Editor (May 6, 2011) if this behavior is related to Java se 1.4 I forgot to mention about it

Solution

Threads consume resources such as memory Blocking / unblocking threads incurs a one - time cost If a thread blocks / unblocks tens of thousands of times per second, it may waste a lot of CPU

But once a thread is blocked, it doesn't matter how long it is blocked, so there is no continuous cost

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>