Java thread scheduling in two ways (synergistic and preemption)

java thread scheduling of two ways:

A cooperative thread scheduling

1. After the implementation of the thread of their work, to take the initiative to inform the system switches to another thread.

2. The benefit is simple, there is no thread synchronization issues.

3. If there is a problem writing a thread, it has not informed the thread switching system, the program would have been blocked there.

4. thread execution time is determined by the control itself.

Two preemptive scheduling

1. thread by the system to allocate the execution time, thread switching thread itself decide not help.

2. The problem does not occur throughout the process leading to a thread blocked.

Published 415 original articles · won praise 434 · views 210 000 +

Guess you like

Origin blog.csdn.net/qq_41901915/article/details/103654263