Mark Ashworth wrote:
> 
> When I use JServ with blackdown jdk1.1.1.7 green threads it starts 1 Java
> process but using native threads it starts 7 Java processes and uses about
> 7 times as much memory.
> 
> I turned on "top" and hit a servlet with multple requests to see which Java
> processes were used. It looks to me like they simulate threads by routing
> requests to different JVMs as they get busy rather than actually using native
> Linux threads.
> 
Probably you should read a little bit more the FAQs on BlackDown about
threads et al.
Native threads, under Linux, are just "virtual processes", so another
process is started, and data is shared between different processes.
I don't know exacly what's the impact on memory (I don't know what's
shared and what's kept in each process, top doesn't give the right
answers, since threads are considered as stand-alone processes, the sum
of the memory they allocate is not "what is allocated by all processes",
a better check could be something like free, seing how much memory is
still availabe to others).
These are the main differences between green and native threads:

Native Advantages:
    Scheduling made by kernel, so IDLE thread will not waste precious
CPU time just to check if a thread is active or not

Native Disadvantages:
    The "spawning" so the initiailization time, is longer than native,
since a kernel call must be made and this would take longer time to
execute.

Green Advantages:
    All is kept in a single "kernel process", so shared memory is not
used, and this consumes, of course, less RAM.

Green Disadvantages:
    Even if all threads are idle, when the JVM process is given "focus",
it checks all threads for their status, and so wasting CPU time.

> Is this a valid approach for a high traffic site? Does each JVM do it's own
> garbage collection separately or do they all stop at the same time?
> 
No, these are not different JVMs, are just different "kernel processes".
The different thing between a "regular" process and a "kernel process"
is that the regular process is a kernel process w/ private memory (so no
other processes can access to it), while a kernel process shares its
memory w/ other kernel processes.

For example, take a look at mysql. Under linux, it uses libpthread (the
same used by JDK). When it starts it opens (seen from PS), around 7/8
processes, but the memory availability (measured w/ free) doesn't go
down as soon as processes are created (there's a difference between
what's reported by PS and by FREE).

On my 32Mb linux box, w/ mysql I was told by PS using something like 50
Mb of RAM, while free reported still 8 mb free...

        Pier




----------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://www.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to