From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <0d5a81f75359a8a2b7ae1680d30de828@quintile.net> From: "Steve Simon" Date: Wed, 8 Apr 2009 19:17:11 +0100 To: 9fans@9fans.net MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] good CSP practice Topicbox-Message-UUID: d69be9a8-ead4-11e9-9d60-3106f5b1d025 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