This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: The direction of malloc?

On Wed, Dec 18, 2013 at 01:01:24AM +0100, Torvald Riegel wrote:
> On Tue, 2013-12-17 at 20:08 +0100, OndÅej BÃlka wrote:
> > On Tue, Dec 17, 2013 at 01:59:57PM +0100, Torvald Riegel wrote:
> > > On Mon, 2013-12-16 at 22:23 +0100, OndÅej BÃlka wrote:
> > > > Please explain how spinning could improve performance in single thread
> > > > applications.
> > > 
> > > You spoke about lockless code, so obviously concurrent code.  My comment
> > > was thus referring to concurrent code.  If you have a single-threaded
> > > program, then you can avoid synchronization, obviously (ignoring
> > > synchronization just for reentrancy...).
> > >
> > And we for malloc use a switch variable to avoid lock path and set it
> > when pthread_create is called? For reentancy a ordinary variable suffices.
> Depending on the algorithm, even for reentrancy you might need atomic
> operations (eg, to keep under control what the compiler does with the
> code, or using a CAS to avoid pending stores).

For reordering barrier it suffices to use

__asm__ __volatile__( "" : : :"memory");

Could a pending write really happen, it is kernel responsibility to do
serialization which includes waiting for pending stores?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]