lkml.org 
[lkml]   [2008]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] Replace completions with semaphores
Date
On Tuesday 15 April 2008, Linus Torvalds wrote:
> Would it make sense to use completions for countable events too? Yeah. In
> fact, we have some things that really would like to do counting, both in
> the sense of "wait for <n> events to all complete" _and_ in the sense of
> "allow up to <n> events to be outstanding". Both of which could be done as
> a counting function (just make "complete" increment the counter, and then
> make "wait for <n> events" initialize it to negative, while "allow <n>
> outstanding events" would be a positive counter, and make
> "wait_for_completion()" basically be a "decrement and wait until it

Hmm, why not introduce a provide_slots(),
wait_for_slot() and free_slot() API?

provide_slots() := initialize a resource with N available slots
wait_for_slot() := wait for a slot in countable resource to be free
free_slot() := make a slot available

That would:
- fit the use case nicely
- could be optimized for countable resources
with upper limits
- allow to measure slot utilization
- ...
- is not called semaphore :-)

And isn't this the same problem (called scheduling) as:
- keeping N cpus busy
- keeping N (disk) spindles busy
- keeping N nic transmit queues busy
- ...

???

But maybe I oversimplify here :-)


Best Regards

Ingo Oeser


\
 
 \ /
  Last update: 2008-04-16 18:05    [W:0.669 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site