mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: Bill Davidsen <davidsen@tmr.com>
Cc: Olivier Galibert <galibert@pobox.com>, linux-kernel@vger.kernel.org
Subject: Re: [Linux-ia64] Re: web page on O(1) scheduler
Date: Wed, 04 Jun 2003 09:13:43 +0200	[thread overview]
Message-ID: <5.2.0.9.2.20030604074452.00ce0380@pop.gmx.net> (raw)
In-Reply-To: <Pine.LNX.3.96.1030603234616.16495B-100000@gatekeeper.tmr.c om>

At 11:52 PM 6/3/2003 -0400, Bill Davidsen wrote:
>On Thu, 29 May 2003, Mike Galbraith wrote:
>
> > That would still suck rocks for mutex usage... as it must with any
> > implementation of sched_yield() in the presence of peer threads who are 
> not
> > playing with the mutex.  Actually, using sched_yield() makes no sense what
> > so ever to me, other than what Arjan said.  It refers to yielding your
> > turn, but from userland "your turn" has no determinate meaning.  There is
> > exactly one case where it has a useable value, and that is  when you're 
> the
> > _only_ runnable thread... at which time it means precisely zero. (blech)
>
>No, it works usefully without threads at all, with processes sharing a
>spinlock in shared memory. If the lock is closed process does a
>sched_yeild() to allow whoever has the lock to run. Yes to all comments
>WRT order of running, if you care you don't do this, clearly. But in the
>case where a process forks to a feeder and consumer it's faster than
>semaphores, signal, etc.

It can only be faster when there is no other source of competition for the 
cpu.  If there is no other competition, the current implementation won't 
hurt, because you'll switch arrays at very high speed... the queue rotation 
will be that which I described earlier.

There's only one real difference between going to sleep and waiting for a 
signal and your description of a proper yield.  Both place you at the end 
of your queue.  One immediately, the other upon wakeup.  How much "other 
stuff" is in the system determines task throughput in both cases.

>All that's needed is to put the yeild process on the end of the
>appropriate run queue and reschedule. Doing anything else results in bad
>performance and no gain to anything else.

And if either party has expired it's timeslice, who is the active task 
yielding to?  Why do you insist that those who have expired their slice 
should not be considered eligible players?  Now, let's throw a real 
monkey-wrench into the works...

What happens with your version of sched_yield() if one of your producer 
consumer pair is SCHED_RR, or worse - SCHED_FIFO [no timeslice, "turn" 
means until it blocks whether that be voluntary or not], and sched_yield() 
is the only way it can get rid of the cpu (ie it's a high priority pure cpu 
burner)?  If all you do is rotate the active queue and reschedule, you have 
just guaranteed that sched_yield() will have zero meaning.  The same exact 
thing (but less exaggerated) will happen if producer and consumer are not 
at the same dynamic priority.  You can call schedule() all you want if 
you're the highest priority runnable task... you get to keep the cpu 
whether you really want it or not.  I still say that sched_yield() makes 
zero sense for this usage.  There is only one guaranteed way to give up the 
cpu, and that is to sleep.

Using sched_yield() as a mutex is exactly the same as using a party line 
for private conversation.

         -Mike 


  parent reply	other threads:[~2003-06-04  6:55 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-21  6:49 David Mosberger
2003-05-21  9:01 ` Arjan van de Ven
2003-05-21 10:40   ` [Linux-ia64] " Duraid Madina
2003-05-21 10:43     ` Christoph Hellwig
2003-05-21 13:12     ` Arjan van de Ven
2003-05-21 13:51       ` Olivier Galibert
2003-05-28 22:12         ` Bill Davidsen
     [not found]         ` <Pine.LNX.3.96.1030528180909.21414B-100000@gatekeeper.tmr.c om>
2003-05-29  5:59           ` Mike Galbraith
2003-06-02  8:05             ` Ingo Molnar
2003-06-04  4:07               ` Bill Davidsen
     [not found]             ` <Pine.LNX.4.44.0306020949520.3375-100000@localhost.localdom ain>
2003-06-02 13:51               ` Mike Galbraith
2003-06-04  3:52             ` Bill Davidsen
2003-06-04  4:55               ` David Schwartz
     [not found]             ` <Pine.LNX.3.96.1030603234616.16495B-100000@gatekeeper.tmr.c om>
2003-06-04  7:13               ` Mike Galbraith [this message]
2003-06-04 15:30                 ` Jan Harkes
2003-05-21 19:18       ` Duraid Madina
2003-05-21 20:03         ` Helge Hafting
2003-05-21 22:59         ` Alan Cox
2003-05-21 15:18   ` David Mosberger
2003-05-23  1:07   ` [Linux-ia64] " Hans Boehm
2003-05-23  8:30     ` Arjan van de Ven
2003-05-21  9:26 ` Mike Galbraith
2003-05-21  9:30   ` Mike Galbraith
2003-05-21 17:56   ` David Mosberger
2003-05-21 20:46     ` Mike Galbraith
2003-05-22  9:52     ` Mike Galbraith
2003-05-22 16:25       ` Mike Galbraith
2003-05-22 17:58         ` David Mosberger
2003-05-27 15:16         ` [case closed] " Mike Galbraith
2003-06-03 20:59       ` sched.c gives ICE [Was: Re: web page on O(1) scheduler] J.A. Magallon
2003-06-03 22:29         ` Mike Galbraith
2003-06-22 22:03         ` J.A. Magallon
2003-06-22 22:10           ` J.A. Magallon
2003-05-22  0:38   ` web page on O(1) scheduler Rik van Riel
     [not found]   ` <Pine.LNX.4.50L.0305212038120.5425-100000@imladris.surriel. com>
2003-05-22  5:52     ` Mike Galbraith
2003-05-22 14:47       ` Valdis.Kletnieks
2003-05-22 16:12         ` Mike Galbraith
2003-05-25  9:17       ` Mike Galbraith
2003-05-21 18:31 ` [Linux-ia64] " David Mosberger
2003-05-21 20:00   ` Cyclades Cyclom-Y ISA on 2.5.69 John Stoffel
2003-05-23 17:48 [Linux-ia64] Re: web page on O(1) scheduler Boehm, Hans
2003-05-23 18:04 ` Davide Libenzi
2003-05-24  0:10 Boehm, Hans
2003-05-24  0:20 ` Davide Libenzi
2003-05-24  0:53 Boehm, Hans
2003-05-24  5:38 ` Davide Libenzi
2003-05-24 14:43   ` Davide Libenzi

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=5.2.0.9.2.20030604074452.00ce0380@pop.gmx.net \
    --to=efault@gmx.de \
    --cc=davidsen@tmr.com \
    --cc=galibert@pobox.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®