[Openais] Thread model of openais?

Steven Dake sdake at redhat.com
Wed Nov 22 11:27:35 PST 2006


On Tue, 2006-11-21 at 21:24 +0100, Hans Feldt (AS/EAB) wrote:
> Thanks for the explanation,
> 
> So the code in a service is executed by exactly three threads, IPC
> request, main and totem?
> 
> These threads run at different priorities but are synchronised by a
> mutex before entering the code of a service?
> 

yes.  This is the serialize mutex.  Services should not have to worry
about multithreading.  If you notice two calls in a service for separate
threads, it is a bug which needs to be fixed.

Regards
-steve

> Regards,
> Hans
> 
> > -----Original Message-----
> > From: Steven Dake [mailto:sdake at redhat.com] 
> > Sent: den 21 november 2006 16:52
> > To: Hans Feldt (AS/EAB)
> > Cc: openais at lists.osdl.org
> > Subject: Re: [Openais] Thread model of openais?
> > 
> > On Mon, 2006-11-20 at 15:50 +0100, Hans Feldt wrote:
> > > Steven, could you please explain how posix threads are used 
> > within openais?
> > > 
> > 
> > Hans,
> > 
> > It depends what components you are talking about.
> > 
> > If you mean the libraries, the libraries are entirely thread 
> > safe.  They use a mutex to protect the handle database as 
> > part of the handle database get and put reference accessors.  
> > The library also should protect reads and write operations 
> > from concurrent operation by using a pthread mutex.  If they 
> > don't, they are broken.
> > 
> > If you mean the executive, threads are used as follows:
> > In a multi-cored CPU and with encryption enabled, threads can 
> > be used to improve performance by encrypting each packet on a 
> > separate processor.
> > 
> > The logger uses a thread to avoid blocking in syslog calls 
> > for any significant period of time.  The logger flushes this 
> > thread at segv, or at application exit.
> > 
> > Each IPC connection has two separate threads.  Their purpose 
> > is to handle IO in each direction.  One thread is input to 
> > the executive (called the request thread), the other thread 
> > is output from the executive (called the dispatch thread).  
> > The purpose of these threads long term is to avoid priority 
> > inversions by ensuring that each library that connects has 
> > its priority read, and then the IPC thread's priority is set 
> > to that of the connecting thread for realtime behavior.
> > 
> > The timer system has a thread which dispatches timer callbacks.
> > 
> > And finally the main thread of execution in which the totem 
> > protocol is operated.
> > 
> > Hope that helps.
> > 
> > > Regards,
> > > Hans
> > > _______________________________________________
> > > Openais mailing list
> > > Openais at lists.osdl.org
> > > https://lists.osdl.org/mailman/listinfo/openais
> > 
> > 




More information about the Openais mailing list