From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,f20ed1bf8d95ab20 X-Google-Attributes: gid1164f8,public From: Dirk Grunwald Subject: Re: Memory consistency problems on the 8400 Date: 1997/03/25 Message-ID: #1/1 X-Deja-AN: 228410279 References: Organization: University of Colorado Newsgroups: comp.sys.dec > from Digital WRL labs [2], which discusses write fences on the > alpha. Is there a system call for performing a memory fence on the > Alpha? i.e., something akin to the following operation which is > available on the T3E? -- Yeah, it's the memory barrier instruction. Depending on your C compiler, you can generate it in a number of ways. I believe that the _mb() routine in /usr/lib/libc.a is simply a memory barrier instruction wrapped in a procedure call. Here's an example of a proper mutex on an Alpha, from the pthread include file. # define pthread_mutex_lock_prim(_m_) asm (" \ ldah %t2,0x10(%r31) ;\ 10: ldl_l %v0,(%a0) ;\ bne %v0,30f ;\ or %v0,%t2,%t0 ;\ stl_c %t0,(%a0) ;\ beq %t0,20f ;\ mb ; \ br %r31,30f ;\ 20: br %r31,10b ;\ 30:", &(_m_)->_Pfield(lock)) -- Dirk Grunwald Assoc. Prof, Univ. of Colorado at Boulder