Are Java threads created in user space or kernel space?

前端 未结 3 945
孤街浪徒
孤街浪徒 2021-02-03 11:04

Check this code out

    Thread t1 = new Thread(new Runnable() {

        @Override
        public void run() 
        {
            try
            {
                    


        
3条回答
  •  滥情空心
    2021-02-03 12:03

    Java threads are "user" threads, but under the hood, the Java Virtual Machine is using kernel threads and delegating the user threads CPU time on each kernel thread in its kernel thread pool. See this question for a better explanation. It seems that threading is JVM-vendor specific, and my understanding might not hold for all JVM implementations.

提交回复
热议问题