> Which reinforces what was said to me before regarding the
> subject of threads and processes -> threads simply offer a
> more convenient way of programming than processes.

There's a flipside to this 'convenience' though, you have
to be very mindful of how your threads access your shared
variables.  Deadlock bugs pop up in a nondeterministic manner
and are notoriously hard to pinpoint.  When you utilize
processes and use IPC mechanisms (other than shared memory)
for passing data back and forth between processes, such concerns
are greatly reduced.

Ironically, because the Linux kernel does not natively support
threads, the old LinuxThreads library (now superceded by
NPTL - Native POSIX Thread Library - with support from the 2.6
kernel) uses the clone() system call [1] to allow processes to
behave (i.e. share memory) like threads [2].



[1] 'man clone',
    http://www.linuxjournal.com/article.php?sid=5211

[2] It uses a 1:1 model (as opposed to 1:N), meaning
each thread corresponds to 1 process and scheduled
correspondingly by the kernel.


Additional links of interest:


(1) The Fibers of Threads
http://www.linux-mag.com/2001-05/compile_01.html

(2) The Native POSIX Thread Library
http://lwn.net/Articles/10710/

(3) Making Linux safe for pthreads
http://lwn.net/Articles/7577/

(4) first NPTL vs. NGPT vs. LinuxThreads benchmark results
http://lwn.net/Articles/10741/
(The 1:1 model NPTL trounces the M:N NGPT in a benchmark
which should supposedly favour the latter)

(5) Ingo Molnar's O(1) Scheduler
http://www.itworld.com/nl/lnx_tip/01182002/

(6) GNU Pth - GNU Portable Threads
http://www.gnu.org/software/pth/pth-manual.html
Non pre-emptive threads; Anyone using this?
( interesting distinction: 'thread-safe' is not
  equivalent to 'reentrant'... hmm.... )
--
Philippine Linux Users' Group (PLUG) Mailing List
[EMAIL PROTECTED] (#PLUG @ irc.free.net.ph)
Official Website: http://plug.linux.org.ph
Searchable Archives: http://marc.free.net.ph
.
To leave, go to http://lists.q-linux.com/mailman/listinfo/plug
.
Are you a Linux newbie? To join the newbie list, go to
http://lists.q-linux.com/mailman/listinfo/ph-linux-newbie

Reply via email to