bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Introduce gsync-based locks to glibc.


From: Agustina Arzille
Subject: [PATCH] Introduce gsync-based locks to glibc.
Date: Fri, 20 May 2016 00:43:37 -0300

Hello, everyone.

Here are the patches needed to get the ball rolling and finally introduce
gsync-based synchronization objects into our libc. These 2 first patches modify
the internal locks used by glibc and some bits in libpthread that will be
necessary for more complex objects.

There are quite a few changes in glibc, so any input you may have will be very
welcomed and appreciated.

Here's a list of changes:

[ glibc ]

* Low-level locks are introduced, replacing spin-locks and cthreads mutexes.
  The interface is closely modelled after Linux's, but with our extensions.

* Glibc's internal locks are thus made to use low-level locks. There were also
  changes in libc's cleanup macros, which now use gcc's attribute of the same
  name (This will come in handy once libpthread uses forced stack-unwinding for
  thread cancellation), and the libc per-thread key interface is now using
  pthread instead of cthreads. This is not just a cosmetic change, but rather
  a correctness issue: cthreads' key creation function doesn't allow us to
  specify a destructor, which lead to memory leaks. Affected interfaces include
  dlerror and strsignal.

* The spin-lock-solid and mutex-lock-solid files are no longer necessary and
  were removed. It's worth noting that glibc can now do efficient and cheap
  synchronization without having to pull in libpthread.

* The files hurd/hurdlock.* have been added, which provide a richer interface
  for locks, including timed acquire and robust locks. This should come in
  handy once (if) we get around to implementing librt and things like system V
  semaphores and message queues.

* Additional errno codes were added: EOWNERDEAD and ENOTRECOVERABLE. They will
  be used by the new pthread mutex implementation.

* All but one instance of busy waiting with __swtch_pri have been removed. The
  last once will eventually be replaced as well once libpthread is able to
  install callbacks for the dynamic linker.

[ libpthread ]

* The file pt-atomic.h has been rewritten to instead implemented atomic
  operations on 64-bit values. Those will be used extensively for many pthread
  objects. The previous atomic operations have been replaced by calls to
  glibc's atomic API.

* The TCB type is also brought from glibc instead of defined manually.

* As per Samuel's request, pthread spin locks are now using gsync instead of
  spinning.

* An extended integer type has been added, which will be used in conjunction
  with the aforementioned 64-bit atomics.

=======================

That's all I have on my notes. I'm attaching the patches to this message. As
always, I'm open to anything you guys want to say :)

Attachment: glibc.diff
Description: Text Data

Attachment: libpthread-init.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]