Actually-

        If you follow Linux-Kernel development (ugh! Many thousands of email!) Linux 
does have "threading" in as much that that the pthread() libraries "emulate" "actual" 
threads.

        The key thing to remember is that Linus and others do not wish to implement 
Kernel-Level threading (pre-emptive kernel threading may be coming in 2.5/6) as they 
do not agree with the basic concept.

        Instead, they rely off of an emulation system to "pretend" to be like a 
light-weight threading system. In reality they're implemented as "cloned" processes. 
From the Java-Linux programming guide from sun:

BEGIN PASTE
About Linux Threads
One major difference between developing on Linux from other Unix operating systems is 
the system threads library. In Java 2 releases prior to 1.3, the Java virtual machine 
uses its own threads library, known as green threads, to implement threads in the Java 
platform. The advantage here is that green threads minimize the Java virtual machine's 
exposure to differences in the Linux threads library and makes the port easier to 
complete. The downside is that using green threads means system threads on Linux are 
not taken advantage of and so the Java virtual machine is not scalable when additional 
CPUs are added. 

In Java 2 Release 1.3, the Hotspot virtual machine uses system threads to implement 
Java threads. Because Linux threads are implemented as a cloned process, each Java 
thread shows up in the process table if you run the ps command. This is normal 
behavior on Linux. 

java -jar Notepad.jar
ps -eo pid,ppid,command 

  PID  PPID COMMAND                            
11667 28367 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar
11712 11667 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar   
11713 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar
11714 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar
11715 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar
11716 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar
11717 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar
11718 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar
11722 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar
11723 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar
11724 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar
11726 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar

In the above listing, the process ID 11712 shown in the left-most PID column is the 
invoked Java virtual machine. The other processes that show process ID 11712 in the 
PPID column have process ID 11712 as their parent process. These children to process 
ID 11712 are Java threads implemented by the Linux system threads library. Each Linux 
thread is created as a process clone operation, which leaves the scheduling of threads 
to be a task of the process scheduler. 

By comparison, on Solaris the Java threads are mapped onto user threads, which in turn 
are run on Lightweight processes (LWP). On Windows the threads are created inside the 
process itself. For this reason, creating a large number of Java threads on Solaris 
and Windows today is faster than on Linux. This means you might need to adjust 
programs that rely on platform-specific timing to take a little longer on startup when 
they run on Linux.  

END PASTE

Jesse Noller
[EMAIL PROTECTED]
Macromedia Server Development
Unix/Linux "special guy" 

> -----Original Message-----
> From: Rudi [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 20, 2002 8:50 AM
> To: CF-Linux
> Subject: RE: Increasingly numerous processes
> 
> At 08.36 Tuesday 20/08/02 -0400, you wrote:
> >Welcome to the wonderful world of Linux "threading" Linux does not have
> >threading itself, instead, it has threading "emulation". This means that
> a
> >parent and children threads display as single processes instead of thread
> >-> child (as on solaris).
> 
> As far as I know, Linux has threading (kernel threads). It's just "top"
> and
> maybe "ps"  output that is broken when it comes to threads (it seems it
> treat them like processes). If you look at top output you can distinguish
> anyway between thread and processes, looking at size, rss and share values
> 
> 
> --
> Rd
> 
> "Soft as the massacre of Suns
>   By Evening's Sabres slain"
> [E.Dickinson]
> 
> 
> 
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-linux%40houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_linux or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to