Java – what makes the execution order of threads unpredictable?

What makes the execution order of threads unpredictable? At some point, the scheduler uses random numbers or checks system resources, or checks which thread is waiting long enough?

Solution

A scheduler is usually the scheduler of an operating system It is affected by many factors, including other processes on the machine, what the hardware is doing (interrupt), etc Depending on the operating system, I think random numbers may sometimes be involved, but I generally don't doubt it More is the unpredictable way that multiple variable time intervals can overlap

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
分享
二维码
< <上一篇
下一篇>>