From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <93f386afe6d3798ebd79035d9675a65d@quintile.net> From: "Steve Simon" Date: Wed, 18 Apr 2007 13:24:29 +0100 To: 9fans@cse.psu.edu MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] locking Topicbox-Message-UUID: 4bfe7f1a-ead2-11e9-9d60-3106f5b1d025 Hi, I have a problem on an OS, its not plan9 but similar, so I thought I would ask here. Say you have a synthetic file which you use to query the state of a subsystem, a plan9 example might /net/dns, my example is reading a port in an fpga. I want to run this multithreaded, but the requests and replies are not atomic on the same file descriptor. Thus I need to have each thread request on its own file descriptor, or, have a Qlock in the requesting program to interlock requests and replies. Now the fun. Some requests can take a long time (hours) so the Qlock is inpractiable, though adding a open per thread is also a pain. When I get problems like this I usually think "how would I do this on plan9", and the only answer I can come up with is to have a single ioproc doing the device access and a load of threads in another proc making requests. Anyone think of a technique I have missed? -Steve