9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: David Presotto <presotto@closedmind.org>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] parallel programming in Plan 9
Date: Wed, 18 Feb 2004 17:52:23 -0500	[thread overview]
Message-ID: <33518834edd190465007f697ab623991@plan9.bell-labs.com> (raw)
In-Reply-To: <4033E8DE.1020501@unm.edu>

[-- Attachment #1: Type: text/plain, Size: 1140 bytes --]

The kernel doesn't support threads per se, there's only one process
type.  Processes may share memory.

Libthread is a user level library that allows multiple threads
per process, in addition to multiple processes.  It also
provides typed CSP like channels.

As a user of libthread, you can start a thread in the current process
	threadcreate()
or in a new process
	procreate()
Threads created in the same process use cooperative scheduling,
i.e, when one yields the processor (implicitly by calling one
of the channel functions or explicitly by calling rendezvous)
another can run.  However these threads are only logicly separate.
Since the kernel knows nothing about them, they can only run
sequentially on a single CPU.  If one calls a blocking system
call (read, sleep, etc) none of the others will run.

Therefore, a process that wants to make use of multiple processors
and/or that wants to allow some threads to block on system calls
will use proccreate (which in turn calls rfork) to create threads in
multipe processes.  You can mix and match; the threads look the same
as far as communication is concerned.

[-- Attachment #2: Type: message/rfc822, Size: 2810 bytes --]

From: James Horey <jhorey@unm.edu>
To: 9fans@cse.psu.edu, schwartz@bio.cse.psu.edu
Subject: Re: [9fans] parallel programming in Plan 9
Date: Wed, 18 Feb 2004 15:36:14 -0700
Message-ID: <4033E8DE.1020501@unm.edu>

Scott Schwartz wrote:

>Russ wrote a nice little essay that addresses some of the language
>level ideas.  Maybe the 9grid folks will write a similar essay
>(if the inferno guys haven't already.)
>
>http://plan9.bell-labs.com/who/rsc/thread/index.html
>
>
>
I am a bit confused about libthread in Plan9; I recall reading that Plan
9 supports creating processes that share the same address space as the
parent process using rfork, but that Plan 9 doesn't really differentiate
between a thread and a process per se. Are threads in libthread just a
convenient representation of a particular type of process or they
different beings altogether?

-James Horey

  reply	other threads:[~2004-02-18 22:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-18 21:02 James Horey
2004-02-18 21:17 ` Scott Schwartz
2004-02-18 22:36   ` James Horey
2004-02-18 22:52     ` David Presotto [this message]
2004-02-18 23:23     ` Scott Schwartz
2004-02-19  5:00 ` andrey mirtchovski
2004-02-19 14:35   ` ron minnich
2004-02-19 14:40     ` boyd, rounin
2004-02-18 21:17 David Presotto
2004-02-19 19:18 ` rog

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=33518834edd190465007f697ab623991@plan9.bell-labs.com \
    --to=presotto@closedmind.org \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).