Java SDK on Linux (problem)  
Author Message
Paul Hovnanian P.E.





PostPosted: 2003-12-20 0:06:00 Top

java-programmer, Java SDK on Linux (problem) I have a Java SDK (j2sdk1.4.1_02) installed on a Linux system (2.2.14).
All seemed to be going well until I noticed something a bit strange.
Running a java app appears to result in the launch of over a dozen
consecutive processes. Suspecting the possibility of a weird, multi
threaded app, I wrote a small test program, Hello.java (appended below).
Same behaviour. Other than setting the CLASSPATH environment variable
appropriately and unpacking the kit, the system appears to have no other
java-specific configuration settings that I can find.

Any ideas?

// Hello.java
package hovnanian.examples.gui;

import javax.swing.*;
import java.awt.*;

public class Hello extends JFrame {
public static void main(String[] args) {
Hello h = new Hello();
}
public Hello() {
super("Hello");

String message = "Hello world!";
Label lbl = new Label( message );
this.getContentPane().add(lbl);
this.pack();
this.setVisible(true);
}
}

--
Paul Hovnanian mailto:email***@***.com
note to spammers: a Washington State resident
------------------------------------------------------------------
Applying information technology is simply finding the right wrench
to pound in the correct screw.
 
Brad BARCLAY





PostPosted: 2003-12-20 1:49:00 Top

java-programmer >> Java SDK on Linux (problem) Paul Hovnanian P.E. wrote:
> I have a Java SDK (j2sdk1.4.1_02) installed on a Linux system (2.2.14).
> All seemed to be going well until I noticed something a bit strange.
> Running a java app appears to result in the launch of over a dozen
> consecutive processes. Suspecting the possibility of a weird, multi
> threaded app, I wrote a small test program, Hello.java (appended below).

And how is it you know that your application is _not_ multithreaded?

Many of the Swing components implement their own threads for managing
event handling. As well, the JVM itself may have seperate threads for
garbage collection and memory heap management.

Just because you're not implementing Runnable or extending Thread
doesn't mean that the resulting application isn't multithreaded.

Brad BARCLAY

--
=-=-=-=-=-=-=-=-=
From the OS/2 WARP v4.5 Desktop of Brad BARCLAY.
The jSyncManager Project: http://www.jsyncmanager.org

 
Darryl L. Pierce





PostPosted: 2003-12-20 4:37:00 Top

java-programmer >> Java SDK on Linux (problem) Paul Hovnanian P.E. wrote:

> I have a Java SDK (j2sdk1.4.1_02) installed on a Linux system (2.2.14).
> All seemed to be going well until I noticed something a bit strange.
> Running a java app appears to result in the launch of over a dozen
> consecutive processes. Suspecting the possibility of a weird, multi
> threaded app, I wrote a small test program, Hello.java (appended below).
> Same behaviour. Other than setting the CLASSPATH environment variable
> appropriately and unpacking the kit, the system appears to have no other
> java-specific configuration settings that I can find.
>
> Any ideas?

Each of those processes is a separate thread inside of the VM or other
process that's needed by it. Nothing to worry about. When I run things I
usually see a dozen or two Java processes at the same time. It's just the
nature of how Linux reports them when you us ps.


--
Darryl L. Pierce <email***@***.com>
Visit the Infobahn Offramp - <http://mypage.org/mcpierce>
"What do you care what other people think, Mr. Feynman?"
 
 
Steve Horsley





PostPosted: 2003-12-20 5:16:00 Top

java-programmer >> Java SDK on Linux (problem) Paul Hovnanian P.E. wrote:
> I have a Java SDK (j2sdk1.4.1_02) installed on a Linux system (2.2.14).
> All seemed to be going well until I noticed something a bit strange.
> Running a java app appears to result in the launch of over a dozen
> consecutive processes. Suspecting the possibility of a weird, multi
> threaded app, <snip>

Yes, Sun's JVM is definitely fits that description.
That's even before you bring Swing into the equation, which also fits
that description very well.

So you have a weird multithreaded app running on a weird multithreaded
interpreter. Expect to see lots of threads. And since Linux shows the
shared memory under each thread, the whole shebang looks to be using
far more memory than it really is. Relax. It's all right.

Steve