Execution order of multiple threads

前端 未结 4 1776
失恋的感觉
失恋的感觉 2020-12-03 16:43

Let\'s say we have this scenario:

class Stack{

public void main{

ChildThread1 t1 = new ChildThread1;
ChildThread1 t2 = new ChildThread1;
ChildThread1 t3 =          


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 16:51

    When you start a thread, the started thread runs in parallel of all the already running threads. The thread scheduler dispatches the various threads on the available processors, and each thread gets some processor time, each in his turn. But the processor, the order and the time assigned to each thread is up to the OS thread scheduler, and you have absolutely no guarantee.

提交回复
热议问题