On Java threads and Linux

Yesterday, I asked a seemingly simple question: What is a Java thread?

In Linux, the concept of a thread is ambiguous. Schedulable units are created through clone, which defines familiar options such as sharing the same thread group (CLONE_THREAD) or sharing the same address spaces (CLONE_VM). The options span about a dozen items, defining I/O context sharing, file descriptors, signal handlers, and so on. The fork call defines few shared options, while pthread_create uses more shared context.

Does Java use pthread_create, fork, or its own variant of clone, or even its own userspace implementation? Java VMs obviously are free to differ in their implementations, but I had to sate my own curiosity regardless.

Continue reading »

Posted in Linux | Tagged , , | Leave a comment