Distinguishing between Java threads and OS threads?

后端 未结 4 753
小鲜肉
小鲜肉 2020-11-28 01:49

How do I distinguish running Java threads and native threads?

In Linux there will be Parent process for every child process, and they say 0 is the parent of all the

4条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-28 02:21

    There is no standard; this completely depends on the Java implementation which you're using. Also, don't mix up "native threads" and "native processes". A process is an isolated entity which can't see into the address space of other processes. A thread is something which runs in the address space of a native process and which can see into the memory of other threads of the same process.

    What you see on Linux is something else: Some versions of Linux create an entry in the process table for each thread of a parent process. These "processes" aren't real processes (in the isolation sense). They are threads which can be listed with the ps command. You can find the process which created them by using the parent PID (PPID).

提交回复
热议问题