Re: timeout/callout small step forward
- From: Jeff Roberson <jroberson@xxxxxxxxxxxxxx>
- Date: Fri, 28 Mar 2008 23:58:02 -1000 (HST)
On Sat, 29 Mar 2008, Hans Petter Selasky wrote:
Hi,
How does this patch handle when multiple callouts use the same mutex ? Imagine
that two threads are about to lock the same mutex, then the second thread
will get nowhere while waiting for the first thread to execute the callback.
You are worried that there will be too much contention or that there is some correctness issue?
If you're worried about contention, it would seem that most callers use some per-object mutex for the callout. So there isn't likely to be much contention among callouts.
_______________________________________________
I think the solution is that callbacks are put in a tree. Giant locked
callbacks go all into the same tree. Else the user of callouts is responsible
for making up the tree.
struct callout {
struct thread *exec_td;
struct callout *parent;
};
struct callout *c;
while (c->parent != NULL) {
c = c->parent;
}
if (c->exec_td != NULL) {
callout should go into the same thread;
} else {
pick the next free thread and set "c->exec_td"
}
Callouts that belong to the same tree are run from the same thread. This does
not only apply for callouts, but also multithreaded node systems ...
Yours
--HPS
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: timeout/callout small step forward
- From: Hans Petter Selasky
- Re: timeout/callout small step forward
- References:
- timeout/callout small step forward
- From: Jeff Roberson
- Re: timeout/callout small step forward
- From: Hans Petter Selasky
- timeout/callout small step forward
- Prev by Date: timeout/callout small step forward
- Next by Date: Re: timeout/callout small step forward
- Previous by thread: Re: timeout/callout small step forward
- Next by thread: Re: timeout/callout small step forward
- Index(es):
Relevant Pages
|
|