Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Is the usage of /usr/include/machine/builtins.h allowed for user  processes?
@ 2000-01-05  5:00 Aurel Balmosan
  0 siblings, 0 replies; only message in thread
From: Aurel Balmosan @ 2000-01-05  5:00 UTC (permalink / raw)


Hi,

Recently I switch from SYSV ipcs semaphores over pthread mutex to spin
locks. For that I use the function found in
/usr/include/machine/builtins.h. I use two function of those:
__RELEASE_SEM_LONG and __ACQUIRE_SEM_LONG_RETRY in the following
context:


static void _Lock(SHM_t *s, SHMlock_t *l)
{       struct timeval tv={0,1};
        int loop=0;
        while (!__ACQUIRE_SEM_LONG_RETRY(&l->u.l.spin, 0)) {
                GenericCheck(s, loop++, l);
                select(0, NULL, NULL, NULL, &tv);
        }
}

static void _Unlock(SHM_t *s, SHMlock_t *l)
{
        __RELEASE_SEM_LONG(&l->u.l.spin);

}

My questions are:
1. Will those function be supported also in 4.0f? (I check 4.0b 4.0d and
4.0e)
2. Do I need to align the integer spin specifically? I currently use  an
alignmend of 256 byte.
3. Am I allowed to use these buildins in the first place?
4. Currently I use a select() to force a context switch. Is there a
better way to do it?
5. Could there be problems in very heavily loaded multi cpu systems?
Well, from the general concept I don't see a problem since the spin's
only lock functions with a max of 5000 cpu cycles while the outer
functions have about 10 to 30 times more.

Regards,


    Aurel Balmosan.






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-01-05  5:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-01-05  5:00 Is the usage of /usr/include/machine/builtins.h allowed for user processes? Aurel Balmosan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox