Dave, Thanks for the response. I did find documentation on the website that I believe points to a bug in the Solaris implementation of MP safe (Solaris lingo is MT Safe).
To be more specific, the stream multiplexed upper write put queue function is executed on the same thread as the lower read queue service function after the lower read queue service function executes the function sequence freezestr(upper write queue), insq (upper write queue), unfreezestr(upper write queue). It is the unfreezestr that actually triggers the upper write put function to be executed. The sun doc says the following ( I believe this is standard for MP Safe SVR4 implementations - Note the constraints mention nothing about freezestr and unfreezestr). Am I missing something obvious? Constraints When Using Locks When adding locks in a module, it is important to observe these constraints: * Avoid holding module private locks across calls to putnext(9F). The module might be reentered by the same thread that called putnext(9F), causing the module to try to acquire a lock that it already holds. This can cause kernel panic. * Do not hold module private locks, acquired in put or service procedures, across the calls to qprocson(9F) or qprocsoff(9F). Doing this causes deadlock, since qprocson(9F) and qprocsoff) wait until all threads leave the inner perimeter. * Similarly, do not hold locks, acquired in the timeout(9F) and bufcall(9F) callback procedures, across the calls to untimeout(9F) or unbufcall(9F). Doing this causes deadlock, since untimeout(9F)and unbufcall(9F) wait until an already executing callback has completed. The first restriction makes it hard to use module private locks to preserve message ordering. MT STREAMS perimeters is the preferred mechanism to preserve message ordering. Jeff Goldszer Senior Software Engineer Computer Network Technologies 65C Commodore Lane West Babylon NY, 11704 Phone: 631-321-5118 FAX: 631-321-5119 -----Original Message----- From: Dave Grothe [mailto:[EMAIL PROTECTED]] Sent: Friday, December 14, 2001 11:42 AM To: Jeff Goldszer Cc: Linux STREAMS Subject: Re: [Linux-streams] Searching for documentation Jeff Goldszer wrote: > This is not an LIS issue. It is just some questions pertaining to Solaris MP > Safe streams programming. I was hoping someone can point me to documentation > that has answers to these questions. > > 1) Are locks (or mutexes) allowed to be used in queue put functions? - > I assume the answer is YES. We use them in our drivers with no problems. Watch out, though, they don't nest. > 2) In the case of a streams multiplexer driver, is an upper write put > queue function allowed to be executed on the same thread that the lower read > queue service function executing? I assume the answer is no if both > functions are allowed to protect a critical region with the same lock. They wouldn't be executed on the same thread, since a single thread can only execute in one place at a time. But Solaris STREAMS is very aggressive w.r.t. multi-threading. So I would assume that two threads could simultaneously execute ANY put or service procedures in Solaris. I have never seen the rules stated explicitly but experience seems to be that they will execute anything at any time unless you prevent it with mutexes. The only thing that I count on is that two threads won't execute the SAME put (service) procedure at the same time. -- Dave _______________________________________________ Linux-streams mailing list [EMAIL PROTECTED] http://gsyc.escet.urjc.es/mailman/listinfo/linux-streams