Scheduling mechanism

Scheduling mechanism

  • The specific scheduling implementation is divided into operating system and JVM
    • There are many scheduling mechanisms for operating systems, and there are two common ones: time slice Unix and preemptive windows
  • All Java virtual machines have a thread scheduler to determine which thread to run at that time. There are two main scheduling models: time-sharing scheduling model and preemptive scheduling model
    • Preemptive scheduling based on time slice rotation method. The thread scheduler will give higher priority more opportunities to run. If the priority is the same, it will be randomly selected, and the execution time will be re-scheduled after the time slice is reached.
  • Thread scheduling is not cross-platform, it depends not only on the Java virtual machine, but also on the operating system. In some operating systems, even if the running thread is not blocked, it will give up the CPU after running for a period of time, giving other threads a chance to run

Guess you like

Origin blog.csdn.net/qq_45874107/article/details/113805959