mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Koen Vandeputte <koen.vandeputte@ncentric.com>
To: musl@lists.openwall.com
Subject: [musl] Simple question regarding read-write locks precedence
Date: Tue, 31 Mar 2020 17:05:27 +0200	[thread overview]
Message-ID: <5a0db239-4121-8a70-832a-e43ce7632d8e@ncentric.com> (raw)

Hi All,

I've written a user app which make use of reader-writer locks.

Topology is pretty simple:

- 1 writer

- 4 readers


Writes only occur once in a while.

Readers are heavy users of the lock.


The default behavior in musl is Reader precedence.

In my usecase, it means that a writer never aquires the lock causing 
writer starvation.

Debugging nicely shows that readers also "jump over" the waiting writer 
as there is always at least 1 reader present in the critical section at 
any time.

Going through the source code shows that there is no support for 
specifying lock attributes which give writers precedence over readers.


Is there an update scheduled to add the required attribute types which 
allow writer precedence to avoid starvation?


Thanks,

Koen


             reply	other threads:[~2020-03-31 15:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31 15:05 Koen Vandeputte [this message]
2020-03-31 15:09 ` Rich Felker
2020-03-31 15:21   ` Koen Vandeputte
2020-03-31 15:26     ` Rich Felker
2020-03-31 17:21       ` Markus Wichmann
2020-03-31 17:37         ` Rich Felker
2020-03-31 18:38           ` Markus Wichmann
2020-03-31 19:02             ` Michael Kerrisk (man-pages)
2020-03-31 19:45               ` Markus Wichmann
2020-03-31 20:15                 ` Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a0db239-4121-8a70-832a-e43ce7632d8e@ncentric.com \
    --to=koen.vandeputte@ncentric.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).