9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "David Leimbach" <leimy2k@gmail.com>
To: "erik quanstrom" <quanstro@quanstro.net>
Cc: 9fans@9fans.net
Subject: Re: [9fans] Plan 9 on Blue Gene
Date: Thu, 31 Jul 2008 07:28:14 -0700	[thread overview]
Message-ID: <3e1162e60807310728o4cf78211ud5ad698d252f972b@mail.gmail.com> (raw)
In-Reply-To: <2049e07e918215a675b00f15ee549436@quanstro.net>

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

On Thu, Jul 31, 2008 at 7:01 AM, erik quanstrom <quanstro@quanstro.net>wrote:

> > I've been writing a lot of Erlang code lately, and I keep thinking about,
> > but not having too much time to do much about, wanting to have a runtime
> for
> > the libthread "threads" that could auto-schedule them to libthread
> "procs",
> > in much the same way Haskell "sparks" may end up real threads, or Erlang
> > processes, might run in parallel.
>
> the model is that there may be any number of procs sharing memory,
> channels, etc.  each proc has at least one thread.  threads have their
> own stack and one one-at-a time.
>
> since threads run one at a time and have a few, well-known calls that
> implicitly schedule, one often needs no locking.  this is like the big
> kernel lock in linux.  and so in general converting threadcreate to
> proccreate will break programs which rely on the implicit mutex

between threads to keep memory accesses from overlapping.


Channels are locked though right, implicitly, such that they can be used as
a "safe" communication mechanism between proccreate'd contexts and
threadcreate'd contexts in a safe way.

Therefore, if you're not sharing memory between threads/procs, the model
holds up just fine for the CSP style concurrency it was intended to
implement.  Basically "don't share", and "just do message passing".

Obviously depending on the C calls involved, some are re-entrant and some
are not, and that makes a rather large difference too.  You don't want to
call strtok from two different threads (unless you have thread local storage
available, then it might be safe).


>
>
> my personal and uninformed opinion is that it's better to be explicit
> about resource sharing and just lock critical sections—or better yet,
> don't overlap data use.  use channels to transfer data.  if there's no
> overlapping data access then proccreate and threadcreate may usually
> be interchangable.


This is exactly what I'm referring to.


>
>
> another personal opinion is that parallelism can be a
> "performance hack".  however, when the speed differences
> between various resources (e.g. disk drive seek vs anything else)
> is great enough, the difference between working and broken
> can be parallelism.


I think if you take the definition of concurrent processes, that is any set
of processes with no defined sequence or ordering to them running, and you
have them cooperating to produce a solution AND they can run at the same
time, you're talking about a form of parallelism.  For many people,
designing code that's concurrent is enough to express the solution in a sane
way, without tracking mutexes and locks and shared resources, and
parallelism is just "icing".

For some "pure parallelism" is the end goal.  And there's often a very
different approach to getting that (OpenMP, Parallel Haskell vs Concurrent
Haskell.  Erlang running with SMP enabled.)


Dave


>
>
> - erik
>

[-- Attachment #2: Type: text/html, Size: 4251 bytes --]

       reply	other threads:[~2008-07-31 14:28 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2049e07e918215a675b00f15ee549436@quanstro.net>
2008-07-31 14:28 ` David Leimbach [this message]
2008-07-31 15:20   ` erik quanstrom
2008-07-31 14:01 erik quanstrom
  -- strict thread matches above, loose matches on Subject: below --
2008-07-26 18:37 Steven Vormwald
2008-07-26 18:47 ` Eric Van Hensbergen
2008-07-30 12:32   ` Roman V. Shaposhnik
2008-07-30 14:07     ` Eric Van Hensbergen
2008-07-30 15:10       ` ron minnich
2008-07-30 15:21         ` Steven D. Vormwald
2008-07-30 15:38           ` Eric Van Hensbergen
2008-07-30 15:41           ` ron minnich
2008-07-30 16:10             ` Steven D. Vormwald
2008-07-30 17:42               ` ron minnich
2008-07-30 17:52                 ` Steven D. Vormwald
2008-07-31 21:32               ` Charles Forsyth
2008-07-30 16:34             ` Joel C. Salomon
2008-07-30 15:25         ` gdiaz
2008-07-30 15:36           ` Eric Van Hensbergen
2008-07-30 23:36             ` David Leimbach
2008-07-31  0:02               ` ron minnich
2008-07-31  0:45                 ` erik quanstrom
2008-07-31  1:48                 ` David Leimbach
2008-07-31  2:23                   ` ron minnich
2008-07-31 12:53                     ` Philippe Anel
2008-07-31 13:35                       ` David Leimbach
2008-07-31 14:11                         ` Philippe Anel
2008-07-31 14:32                           ` David Leimbach
2008-07-31 16:04                       ` ron minnich
2008-08-04 23:19                     ` Uriel
2008-07-31 13:24             ` gdiaz
2008-07-31 13:24             ` gdiaz
2008-07-30 15:40           ` ron minnich
2008-07-30 17:36             ` don bailey
2008-07-30 17:39               ` Benjamin Huntsman
2008-07-30 17:47                 ` ron minnich
2008-07-30 18:03               ` don bailey
2008-07-30 18:08                 ` Eric Van Hensbergen
2008-07-30 18:18                 ` ron minnich
2008-07-30 18:21                 ` erik quanstrom
2008-07-30 18:32                   ` ron minnich
2008-07-31 22:03                   ` Charles Forsyth
2008-07-31 22:06                     ` ron minnich
2008-07-31 21:27           ` Charles Forsyth
2008-07-30 15:43         ` Jack Johnson

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=3e1162e60807310728o4cf78211ud5ad698d252f972b@mail.gmail.com \
    --to=leimy2k@gmail.com \
    --cc=9fans@9fans.net \
    --cc=quanstro@quanstro.net \
    /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).