From: Aurel Balmosan <ab@orga.com>
Subject: Is the usage of /usr/include/machine/builtins.h allowed for user processes?
Date: 2000/01/05 [thread overview]
Message-ID: <3873896C.74EDE248@orga.com> (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.
reply other threads:[~2000-01-05 5:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox