How java threads are scheduled?

前端 未结 4 2113
后悔当初
后悔当初 2021-01-06 09:00

I have recently started multi-threaded programming with Java in case of Linux threads , i know that the kernel schedules them(as they are the unit entities that are schedule

4条回答
  •  梦毁少年i
    2021-01-06 09:22

    "but java programs are run on JVM which in my system (RHEL 6.1) is implemented as a program that is run as a user space instance.So, without the kernel being aware of the java threads ..."

    This statement is incorrect for all modern JVM's that use native threads. I think thats been the default since Java 1.2. Native Thread implementation by a JVM means that each time a thread instantiates/runs a thread in Java code, the JVM asks the OS to create the thread. Since these are native threads, the kernel knows about them and treats them accordingly. Furthermore, Linux supports/implements POSIX threads, and as such on a Linux based systems you will get pthread behavior for your Java apps' threads

提交回复
热议问题