This is the mail archive of the libc-alpha@sources.redhat.com 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: malloc() and spinlocks


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wolfram Gloger wrote:

> Are you sure?  The patch doesn't contain pure spinlocks;
> __sched_yield() is called after N lock attempts. 

sched_yield() isn't guaranteed to do anything.  Several projects used
sched_yield() over time and all of them broke sooner or later.  jakub,
what's the OO.org story?

Anyway, assume all spinlocks are taken by low-priority threads.  In
comes a high-priority thread.  It is runnable.  Therefore sched_yield()
will find that it always has the right to the CPU.  The only thing you
could do is use nanosleep() instead of sched_yield() but this could and
would create horrible delays and again would require adjusting the code
to the kernel since below a system-dependent delay the waiting is
active, i.e., the system call is delayed in the kernel and the thread is
not put to sleep.

All this is not a problem with futexes.

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+IwM02ijCOnn/RHQRAv1NAKC3Mvzn7625C8rDddw11QBiPJxLYgCdEzKl
P+P93MhcPcP/C0DlnN9LpmY=
=8YWw
-----END PGP SIGNATURE-----


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