[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] POSIX threading library branch, master, updated. d8569a7a43651ca1c
From: |
Richard Braun |
Subject: |
[SCM] POSIX threading library branch, master, updated. d8569a7a43651ca1c1149540619254e224ed7c9e |
Date: |
Thu, 26 Dec 2013 20:25:30 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "POSIX threading library".
The branch, master has been updated
via d8569a7a43651ca1c1149540619254e224ed7c9e (commit)
from 01f8736f297da40f0ee327d73794579be2ec3ecf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d8569a7a43651ca1c1149540619254e224ed7c9e
Author: Richard Braun <address@hidden>
Date: Thu Dec 26 21:19:58 2013 +0100
Implement thread destruction
This change makes libpthread release almost every resource allocated for
a thread, including the kernel thread, its send right, its reply port
and its stack. This improves resource usage after peaks of activity
during which servers can create hundreds or even thousands of threads.
To achieve this, the library relies on the recently added
thread_terminate_release one-way GNU Mach RPC, which allows threads to
release their last resources along with terminating in a single
operation. The pthread_exit function unconditionally releases all the
resources it can, including other kernel objects (namely the port used
for blocking and waking up) and signal states. When releasing the
pthread structure, a reference counter is used so that joinable threads
remain available. Once the reference counter drops to 0, the pthread
structure can be recycled. Thread local storage (TLS) is also recycled
since it needs to remain allocated while terminating the thread, as it
is there that the reply port is stored. TLS could be released too, after
grabbing the reply port name, but it is difficult to make sure no RPC
involving a reply port is used afterwards, so the simpler solution of
recycling TLS was chosen.
* Makefile (libpthread-routines): Replace pt-thread-halt with
pt-thread-terminate.
* pthread/pt-alloc.c (initialize_pthread): Set reference counter and
unconditionally initialize new threads completely.
(__pthread_alloc): Remove call to __pthread_thread_halt, update calls
to initialize_pthread.
* pthread/pt-create.c (__pthread_create_internal): Don't attempt to
reuse stacks, handle reference counter, update failure handling.
* pthread/pt-dealloc.c: Include bits/pt-atomic.h.
(__pthread_dealloc): Make pthread structure available for reuse when
reference counter reaches 0.
* pthread/pt-detach.c (pthread_detach): Assume the target thread takes
care of its own resources and, as a result, simply unreference its
pthread struct.
* pthread/pt-exit.c (__pthread_exit): Release resources and terminate.
* pthread/pt-internal.h (struct __pthread): New `nr_refs' member.
(__pthread_alloc): Update description.
(__pthread_dealloc): Likewise.
(__pthread_thread_dealloc): Likewise.
(__pthread_thread_terminate): New declaration.
* pthread/pt-join.c (pthread_join): Assume the target thread takes care
of its own resources and, as a result, simply unreference its pthread
struct.
* sysdeps/mach/hurd/pt-sigstate-destroy.c
(__pthread_sigstate_destroy): Call _hurd_sigstate_delete.
* sysdeps/mach/hurd/pt-sigstate-init.c (__pthread_sigstate_init): Call
_hurd_thread_sigstate and _hurd_sigstate_set_global_rcv when
appropriate.
* sysdeps/mach/hurd/pt-sysdep.c (__pthread_create_internal): Prevent
the library from releasing the stack of the main thread.
* sysdeps/mach/hurd/pt-sysdep.h (PTHREAD_SYSDEP_MEMBERS): Remove
`have_kernel_resources' from the list of sysdep members.
* sysdeps/mach/pt-thread-alloc.c (__pthread_thread_alloc): Update
thread allocation.
* sysdeps/mach/pt-thread-dealloc.c (__pthread_thread_dealloc): Update
description.
* sysdeps/mach/pt-thread-halt.c: Remove file.
* sysdeps/mach/pt-thread-start.c (__pthread_thread_start): Fix the
conditions under which a thread should actually be started.
* sysdeps/mach/pt-thread-terminate.c: New file.
-----------------------------------------------------------------------
Summary of changes:
Makefile | 2 +-
pthread/pt-alloc.c | 22 ++--------
pthread/pt-create.c | 69 ++++++++++++++----------------
pthread/pt-dealloc.c | 5 ++
pthread/pt-detach.c | 24 ++--------
pthread/pt-exit.c | 35 +++++++--------
pthread/pt-internal.h | 36 +++++++++------
pthread/pt-join.c | 18 +-------
sysdeps/mach/hurd/pt-sigstate-destroy.c | 2 +-
sysdeps/mach/hurd/pt-sigstate-init.c | 18 +++++++-
sysdeps/mach/hurd/pt-sysdep.c | 5 ++
sysdeps/mach/hurd/pt-sysdep.h | 3 +-
sysdeps/mach/pt-thread-alloc.c | 31 +++----------
sysdeps/mach/pt-thread-dealloc.c | 3 +-
sysdeps/mach/pt-thread-halt.c | 37 ----------------
sysdeps/mach/pt-thread-start.c | 4 +-
sysdeps/mach/pt-thread-terminate.c | 72 +++++++++++++++++++++++++++++++
17 files changed, 194 insertions(+), 192 deletions(-)
delete mode 100644 sysdeps/mach/pt-thread-halt.c
create mode 100644 sysdeps/mach/pt-thread-terminate.c
hooks/post-receive
--
POSIX threading library
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] POSIX threading library branch, master, updated. d8569a7a43651ca1c1149540619254e224ed7c9e,
Richard Braun <=