lkml.org 
[lkml]   [1997]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: your mail
Date

Alan Cox writes:
>Myth warning. If your process happens to running real time this doesnt come
>out too well. I guess you might argue the behaviour (not yielding) is right
>but you might get some suprises, especially on an SMP box where the following
>is not safe
>
> while(!irq_occured)
> schedule();
>
>Take a look at stuff like sched_yield()

Well, the original poster wasn't using kernel threads, as I understood,
and polling with schedule() has never been a hot idea anyway -- that's
why I have the KHG cover wait queues a little bit...

It sounds like the rule is now:
o You can use schedule() when you just want to possibly give time
to other processes, modulo scheduling policy now in effect. After
all, schedule() didn't always yield in the past; it only yielded if
there was any reason to do so.
o Don't poll with schedule()! It's never been the right thing to
do; that's what wait queues are for. Now this bad idea is unsafe
on SMP boxes.
o If you are writing a kernel thread, then pay attention to how you
have set the scheduling hints for the thread and understand that
they will affect your scheduling (obviously). See sched_yield() for
more information (I haven't seen it so I can't say anything more).

Is that about right?

michaelkjohnson

"Ever wonder why the SAME PEOPLE make up ALL the conspiracy theories?"



\
 
 \ /
  Last update: 2005-03-22 13:39    [W:0.041 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site