Pere Serra wrote:
> 
> I have an easy question:
> What's the difference between native threads and green theads?
> Which one is more eficient/stable?
> 

(from blackdown:)

Native threads use the operating system to do the task switching.

Native threads are thus a benefit in multi-processor (SMP) systems
and they tend to make native method invocation support easier to
deal with.

Native threads do have some limitations relative to green threads.
They require more overhead and are limited to the number of processes
your Linux kernel supports.

Note, that while the native threads support works very well and has
been tested by the Java-Linux porting team, it should still be viewed
as "beta" code as it has not had the extended testing that the
green threads code has. (November 98)

Also, at this time there is no native threads support for libc5 systems.
Only glibc based Linux systems.


Native Threads vs Green Threads
-------------------------------

This release includes both green and native threads.  Green threads are
user based theads that have been part of the JDK since its inception.
Green threads  are very stable, have a lower memory footprint, and
involve much lower overhead for creation and context switching.

Native threads are linux threads (one-to-one implementation of pthreads)
and are kernel based.  Each thread is basically a clone of the its
parent process and therefore has a higher overhead for context
switching and creation and a larger memory footprint.  Because they
are processes, the number of threads is limited by the number of
processes/tasks built into the Linux kernel. You will have to recompile
your kernel to handle larger number of threads.

So why use native threads? Native threads deal better with some JNI
native C programs than green_threads because you do not have to make
all io non-blocking and therefore do not have to redefine all of the
system calls related to io.  But the main reason to use native
threads is that on multi-processor systems, native threads can be
easily split among processors greatly improving performance while
green_threads can not.  Although on single processor systems, green
threads will probably be faster for most programs.



Volker


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to