rreyes1979
rreyes1979

Reputation: 1945

Real Time Java threads and OS Level threads on Linux

When using real time java threads (either RealtimeThread or NoHeapRealtimeThread), is there a 1 to 1 relationship between OS Level threads and Java threads? Also, is Java using fork() or clone() for each of the processes created at the OS Level?

Upvotes: 4

Views: 1075

Answers (3)

user207421
user207421

Reputation: 311054

is Java using fork() or clone() for each of the processes created at the OS Level?

If you mean processes created by Runtime.exec(), it must use fork(). If you are still referring to threads it cannot use fork(), as threads are not processes.

Upvotes: 0

user658991
user658991

Reputation: 566

Java thread on linux depends on the version, but most modern implementations use pthread, the thread for linux, not really a process. the linux thread is also know as lightweight processes, which is not generated by an fork call, but rather the pthread call. Threads run under the same process, and can share certain resources.

Yes they are of 1 to 1 relationship, (ps -Lf), but it is really hard to find out which is which, as the os thread id is an magic number only the jvm knows.

The article below should help.

http://linuxprograms.wordpress.com/2007/12/19/linux-kernel-support-for-threads-light-weight-processe/

Upvotes: 2

Olaf
Olaf

Reputation: 6289

From what I have seen on a RedHat 3.x - 5.x with Sun/Oracle JVM, It's a one OS process per Java thread. Don't know about fork vs. clone though.

Upvotes: -1

Related Questions