From: Stijn Devriendt <highguy@gmail.com>
To: mingo@elte.hu, peterz@infradead.org, linux-kernel@vger.kernel.org
Subject: [RFC][PATCH] sched_wait_block: wait for blocked threads
Date: Sun, 15 Nov 2009 20:04:18 +0100 [thread overview]
Message-ID: <1258311859-6189-1-git-send-email-HIGHGuY@gmail.com> (raw)
Hi Ingo, Peter, all,
The attached patch is a prototype for a new system call which
allows threads to wait for other threads being blocked.
Its main use is to allow threading libraries to resume
executing more CPU-bound work when one of its threads is
blocked while not having to over-allocating threads in a
normal situation.
Benefit over asynchronous I/O is that a threadpool
thread that performs asynchronous I/O might not have
work enough in one item to keep the CPU busy during the
whole asynchronous operation and that not all operations
are async capable.
Giving control back to the library through a thread
waiting for the blocked one allows new workitems to be
executed as long as the former is blocked.
Code performing this wait could look like:
pid_t parent = ...;
while (waitpid(parent, NULL, WNOHANG) != 0)
{
if (sched_wait_block(parent, NULL) == 0)
{
// do work, possibly notify threadpool manager
// to start another thread blocked on this one
// first
}
}
Any feedback on the concept is much appreciated.
Regards,
Stijn Devriendt
next reply other threads:[~2009-11-15 19:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-15 19:04 Stijn Devriendt [this message]
2009-11-15 19:04 ` [PATCH] Initial prototype version of sched_wait_block Stijn Devriendt
2009-11-16 8:35 ` [RFC] observe and act upon workload parallelism: PERF_TYPE_PARALLELISM (Was: [RFC][PATCH] sched_wait_block: wait for blocked threads) Ingo Molnar
2009-11-16 18:02 ` Linus Torvalds
2009-11-16 18:18 ` Linus Torvalds
2009-11-16 18:31 ` Alan Cox
2009-11-16 19:49 ` Stijn Devriendt
2009-11-16 20:13 ` Ingo Molnar
2009-11-21 11:26 ` Stijn Devriendt
2009-11-16 19:13 ` Stijn Devriendt
2009-11-16 20:22 ` Ingo Molnar
2009-11-18 9:30 ` Stijn Devriendt
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=1258311859-6189-1-git-send-email-HIGHGuY@gmail.com \
--to=highguy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox