tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Jennings" <>
Subject Re: ** JVM and Processes
Date Fri, 01 Jun 2001 16:32:53 GMT
RE: ** JVM and ProcessesMy understanding of green vs. native threads is as follows:
With native threads, an actual system thread is created when a Java thread is created.
On linux a system thread takes the form of another process, but one that shares memory
etc. with another process. This is why if you create a program that allocates 100 megs of
then spins off 10 threads, it looks like 10 processes each taking up 100 megs of memory, when
fact the amount of memory is 100 megs + 10*overhead for each thread (not much more than 100

On WIN32 systems, threads do not show up as separate processes, they are separate threads
of execution
inside the same process (essentially the same as the Linux implementation with differences
too subtle to care about)

Green threads on the other hand use timers, signals, setjmp etc. voodoo to "simulate" threads
within one process.
Essentially taking over the scheduling from the kernel.

I believe the command-line option for green threads is simply "-green" as in
java -green MyThreaddedApp

If you have a multi-cpu system, green threads will only take advantage of one cpu, whereas
native threads
will use all the cpus on your system (that's the theory anyway)

I've heard of problems with blocking I/O with green threads, but have no first hand knowledge.

Hope this helps.
-Mike Jennings

  ----- Original Message ----- 
  From: BARRAUD Valérie 
  To: '' 
  Sent: Friday, June 01, 2001 9:01 AM
  Subject: RE: ** JVM and Processes 

    -----Message d'origine----- 
    De: [] 
    Date:   vendredi 1 juin 2001 17:46 
    Objet:  RE: ** JVM and Processes 


    Thanks for the advice. Could you be a little more specific, though, about 
    how to use green threads instead of native threads and possibly differences 
    between the two? Thanks. 

     - Adam 

    At 10:59 AM 6/1/2001 -0400, you wrote: 
    >       Don't use ps - these are actually threads.  ps is showing them as 
    >processes because that is what it does.  If you use green thread (as opposed 
    >to the native threads you are using now), the display will go away, but you 
    >will experience a slowdown (how much depends on your operating system and 
    >other activity on the system). 
    >       Randy 
    >> -----Original Message----- 
    >> From: [] 
    >> Sent: Friday, June 01, 2001 10:37 AM 
    >> To: 
    >> Subject: ** JVM and Processes 
    >> Hi, 
    >> For a particular web server we are running with Tomcat 3.1, 
    >> we are having 
    >> an issue with the java servlets that are running. What appears to be 
    >> happening is that each time a servlet is called from the web 
    >> site, a new 
    >> process is created to run the java program. When I view 
    >> processes with "ps 
    >> ax", I see dozens of instances of: 
    >> /usr/java/jdk1.3/bin/i386/native_threads/java 
    >> It was briefly stated in Java Servlet Programming by Hunter & 
    >> Crawford, (c) 
    >> Oreilly that 'most servlet containers execute all servlets in 
    >> a single JVM 
    >> ... the exception being high-end containers that support 
    >> execution across 
    >> multiple backend servers...' 
    >> We are only using 1 web server with an average weekly load of 
    >> a couple of 
    >> hundred visitors. 
    >> Any ideas as to why we would be seeing so many identical 
    >> processes and if 
    >> so, how to modify that? 
    >> Thanks in advance. 
    >>   -Adam 

View raw message