9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] good CSP practice
@ 2009-04-08 18:17 Steve Simon
  0 siblings, 0 replies; only message in thread
From: Steve Simon @ 2009-04-08 18:17 UTC (permalink / raw)
  To: 9fans

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-08 18:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-08 18:17 [9fans] good CSP practice Steve Simon

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).