> John Salvo wrote:
> 1) In the man page for "package require java", it said that "Tcl will
> create a JVM in Tcl's process space". What does this exactly mean? In
> both linux and solaris, when I call "package require java" in a Tcl
> shell, I cannot see a java process runnning ( even with linux's "ps
> axf" command ). To be honest, I was expecting a Java process somehow
> as a child of the tcl process, but that does not seem to be the case.
> What are the differences ( and implications ) between what I was
> expecting and what tclblend actually does?
>From the perspective of TclBlend, the JVM is loaded as a shared
library into Tcl's address space, some data structures and C
function pointers are initialized, and the C side of things can
start calling into the Java side of things to load classes,
call methods, and potentially start threads. On linux, as
threads get started, they would show put with "ps" as child
processes. On Solaris, threads are totally internal to the
process that created them, not visible with ps, so you'd need
to use a tool like /usr/proc/bin/pstack, a thread-aware
debugger, or some other tool to see them.
> 2) How many JVMs are created within the lifetime of the tcl process?
> For example, if multiple tcl scripts have a "package require java" as
> the first line of each of the script, will each call to "package
> require java" create a new JVM?
I believe it would be one JVM for the one process. I think the only
other possibility would be one JVM per interp. Mo?
[ . . . ]
> Probably a better way to ask question [3] is: If I was doing threading
> in Tcl, will each thread run its own JVM?
Well, that depends on the answer to 2, which I'm not very sure of...
-=- D. J.
|