Skip to content

Commit

Permalink
Document USE_RWLOCK macro
Browse files Browse the repository at this point in the history
(fix of commit 3bfb499)

Issue #473 (bdwgc).

* docs/README.macros (USE_RWLOCK): Document.
* docs/scale.md (Options for enhanced scalability): Document USE_RWLOCK
macro.
  • Loading branch information
ivmai committed Oct 11, 2023
1 parent 43ef26f commit 17fc443
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/README.macros
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,10 @@ GC_USE_DLOPEN_WRAP Causes the collector to redefine malloc and
dlopen and dlsym to refer to the original versions. This makes it possible
to build an LD_PRELOADable malloc replacement library.

USE_RWLOCK Use rwlock for the allocator lock instead of mutex.
Thus enable usage of the reader (shared) mode of the allocator lock where
possible.

THREAD_LOCAL_ALLOC Defines GC_malloc(), GC_malloc_atomic() and
GC_gcj_malloc() to use a per-thread set of free-lists. These then allocate
in a way that usually does not involve acquisition of the allocator (global)
Expand Down
7 changes: 7 additions & 0 deletions docs/scale.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ This _reduces performance_ for the standard allocation functions, though
it usually improves performance when thread-local allocation is used heavily,
and, thus, the number of short-duration lock acquisitions is greatly reduced.

Also, `USE_RWLOCK` macro (experimental) should be noted which changes the
allocator lock implementation base from a mutex (`CRITICAL_SECTION` in case
of Win32) to `pthread_rwlock_t` (`SRWLOCK`, respectively), thus enabling
acquisition of a slim lock in the reader (shared) mode where possible. See
the description of `GC_call_with_reader_lock` and `GC_REVEAL_POINTER` entities
in `gc.h` for more details.

## The Parallel Marking Algorithm

We use an algorithm similar to
Expand Down

0 comments on commit 17fc443

Please sign in to comment.