9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Steve Simon" <steve@quintile.net>
To: 9fans@9fans.net
Subject: [9fans] good CSP practice
Date: Wed,  8 Apr 2009 19:17:11 +0100	[thread overview]
Message-ID: <0d5a81f75359a8a2b7ae1680d30de828@quintile.net> (raw)

As an uneducated programmer, used to threads,
semaphores, mutexes and queues, I am embarking on
a multithreaded file server.

My server speaks a protocol on a network socket,
and exposes a virtual file system containing both
data and control files.

the data file maps directly to a Channel, but the control
file can take several different types of message.

Should I create a Channel for each type or message or should
I have a single control file and messages of the form:

	struct Msg {
		int type;
		char *ctrlmsg;
	};

and then demultiplex in my receiving thread?

I know Channels and Threads are cheap but is it good practice
to use them with impunity?


[I remembers a lecture on the Transputer -
"just think of creatinga process as being as cheap as a
function call" ]

-Steve



                 reply	other threads:[~2009-04-08 18:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=0d5a81f75359a8a2b7ae1680d30de828@quintile.net \
    --to=steve@quintile.net \
    --cc=9fans@9fans.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).