Rene Gollent | 22 Aug 2009 01:54
Picon

Signals and preemption-related question

Hi,

Michael and I were having a discussion about the current behavior with
respect to preemption on release_sem_etc and/or signal delivery, and
an uncertain question crops up: In quite a few cases, if a thread is
woken up by either one, that wakeup is being used as a communications
mechanism between two threads (i.e. to wake up another thread and tell
it data is ready to be worked on). However, the scheduler currently
only preempts if the new thread's priority is greater than that of the
instigator. In cases like this though, it's entirely possible the two
threads will be of equal priority, and as such that strategy might
result in undesired latency on waking up the recipient since the
sender will be allowed the rest of its timeslice. However, at the same
time, if we did signal preemption on equal priority, there's still no
guarantee that the target thread will in fact be the one woken up due
to a) the 20% random factor we use for priority skipping, and b) the
fact that we enqueue new threads at the end of the list of waiting
threads at the same priority, and as such if another is waiting it
will go first (if it goes at all). Is this a situation we want to deal
with, and if so, any thoughts on how?

Regards,

Rene

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
(Continue reading)

Ingo Weinhold | 22 Aug 2009 17:08
Picon
Picon

Re: Signals and preemption-related question


On 2009-08-22 at 01:54:20 [+0200], Rene Gollent
<anevilyak@...> wrote:
> 
> Michael and I were having a discussion about the current behavior with
> respect to preemption on release_sem_etc and/or signal delivery, and
> an uncertain question crops up: In quite a few cases, if a thread is
> woken up by either one, that wakeup is being used as a communications
> mechanism between two threads (i.e. to wake up another thread and tell
> it data is ready to be worked on). However, the scheduler currently
> only preempts if the new thread's priority is greater than that of the
> instigator. In cases like this though, it's entirely possible the two
> threads will be of equal priority, and as such that strategy might
> result in undesired latency on waking up the recipient since the
> sender will be allowed the rest of its timeslice.

Please keep in mind that lower latencies are bought with additional 
scheduling overhead and lower throughput. When both threads have the same 
priority, there's simply no rectification for doing that. Unless you base the 
decision on additional criteria like overall/current run/waittime of the 
involved threads (i.e. fairness criteria) or to-be-introduced special 
attributes/properties of locking primitives (e.g. an "interactivity buff").

> However, at the same
> time, if we did signal preemption on equal priority, there's still no
> guarantee that the target thread will in fact be the one woken up due
> to a) the 20% random factor we use for priority skipping, and b) the
> fact that we enqueue new threads at the end of the list of waiting
> threads at the same priority, and as such if another is waiting it
> will go first (if it goes at all). Is this a situation we want to deal
(Continue reading)

André Braga | 22 Aug 2009 19:54
Picon

Re: Signals and preemption-related question

Em 22/08/2009, às 12:08, Ingo Weinhold <ingo_weinhold <at> gmx.de> escreveu:
> Please keep in mind that lower latencies are bought with additional
> scheduling overhead and lower throughput. When both threads have the  
> same
> priority, there's simply no rectification for doing that. Unless you  
> base the
> decision on additional criteria like overall/current run/waittime of  
> the
> involved threads (i.e. fairness criteria) or to-be-introduced special
> attributes/properties of locking primitives (e.g. an "interactivity  
> buff").

FINALLY! I've been waiting 2 years now for someone to actually  
consider this :D
*Thank you*!

> The "20% skip" and "enqueue at the end" are really fairness issues.  
> So, if
> you're generally concerned about fairness, those should be  
> addressed. I'd
> rather work on making the affine scheduler more affine first, though.

Well, since this overlaps a lot with many other scheduling /policies/,  
and I'm also addressing those, I think energy is better spent  
implementing something that is usable at the /mechanism/ level, namely  
the topology graph that was discussed a few months ago. That I could  
benefit from a lot for the load balancer, but I don't currently have  
the necessary knowledge of x86 and its MSRs to implement myself...

Cheers,
(Continue reading)

Ingo Weinhold | 22 Aug 2009 21:17
Picon
Picon

Re: Signals and preemption-related question

On 2009-08-22 at 19:54:17 [+0200], André Braga <meianoite <at> gmail.com> wrote:
> Em 22/08/2009, às 12:08, Ingo Weinhold <ingo_weinhold <at> gmx.de> escreveu:
> > Please keep in mind that lower latencies are bought with additional
> > scheduling overhead and lower throughput. When both threads have the
> > same
> > priority, there's simply no rectification for doing that. Unless you
> > base the
> > decision on additional criteria like overall/current run/waittime of
> > the
> > involved threads (i.e. fairness criteria) or to-be-introduced special
> > attributes/properties of locking primitives (e.g. an "interactivity
> > buff").
> 
> FINALLY! I've been waiting 2 years now for someone to actually
> consider this :D
> *Thank you*!

Sorry I got you all excited and have shoot you down again. My intention was 
really only to list examples. I'm no fonder of the idea of tagging locking 
primitives than I was when you brought it up. You are still free to implement 
that concept and demonstrate its measurable benefits, though.

CU, Ingo

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
(Continue reading)

André Braga | 22 Aug 2009 23:52
Picon

Re: Signals and preemption-related question

Em 22/08/2009, às 16:17, Ingo Weinhold <ingo_weinhold <at> gmx.de> escreveu:
> Sorry I got you all excited and have shoot you down again. My  
> intention was
> really only to list examples. I'm no fonder of the idea of tagging  
> locking
> primitives than I was when you brought it up. You are still free to  
> implement
> that concept and demonstrate its measurable benefits, though.

Oh, bummer. Still it's nice to have that idea remembered even if just  
for exemplification purposes.

Anyway, that's indeed the plan. I'm working full time and taking a  
computer graphics course in the night as well, so my free time was  
radically reduced, but I hope to bring better news soon. 
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Open-beos-kernel-devel mailing list
Open-beos-kernel-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-beos-kernel-devel

Gmane