mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Schwartz" <davids@webmaster.com>
To: "Mohit Aron" <aron@Zambeel.com>, <linux-kernel@vger.kernel.org>
Subject: RE: system call sched_yield() doesn't work on Linux 2.2
Date: Sun, 4 Feb 2001 16:21:16 -0800	[thread overview]
Message-ID: <NCBBLIEPOCNJOAEKBEAKAEKINHAA.davids@webmaster.com> (raw)
In-Reply-To: <2B8089144916D411896D00D0B73C8353DB2C1D@exchange.zambeel.com>


> What version of Linux are you using ? What I see is the following:

	I'm using 2.4.1-pre10, glibc 2.1.3.

> 	Thread1
> 	Thread1
> 	Thread1
> 	Thread1
> 	Thread1
> 	Thread2
> 	Thread2
> 	Thread2
> 	Thread2
> 	Thread2

	That's totally reasonable, although you probably just forgot to fflush.

	It's also possible Thread1 did all its work, yields and all, before Thread2
even got started. Thus Thread1 had no 'ready to run' thread to yield to.
(The main thread may not have been ready to run, it may still have been
waiting to synchronize to the new thread it created.)

> Also, it is NOT unrealistic to expect perfect alternation.

	Find one pthreads expert who agrees with this claim. Post it to
comp.programming.threads and let the guys who created the standard laugh at
you. Scheduling is not a substitute for synchronization, ever.

> The definition
> of sched_yield in the manpage says that sched_yield() puts the
> thread under
> question last in the run queue. So perfect alternation should
> have occurred.

	Your reasoning is totally invalid and ignores so many possible other
factors. For example, who says that the writes that your threads are doing
don't block?

> I've also tested the code on Solaris - there is perfect alternation there.

	I'm not sure I understand what this has to do with anything. If you think
so, then I don't think you appreciate with a standard actually is. Perfect
alternation is reasonable, expecting perfect alternation is not. Probably
the reason you got perfect alternation in Solaris is because you only had
one kernel execution vehicle. Try it with system contention scope threads.

	DS


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  reply	other threads:[~2001-02-05  0:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-04 17:45 Mohit Aron
2001-02-05  0:21 ` David Schwartz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-02-05  7:27 Mohit Aron
2001-02-05  5:29 Matt
2001-02-05  6:03 ` Davide Libenzi
2001-02-05  4:33 Robert Guerra
2001-02-05 20:03 ` David Schwartz
2001-02-05  4:02 Mohit Aron
2001-02-05 16:49 ` Rik van Riel
2001-02-03 22:53 Mohit Aron
2001-02-04 11:08 ` David Schwartz

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=NCBBLIEPOCNJOAEKBEAKAEKINHAA.davids@webmaster.com \
    --to=davids@webmaster.com \
    --cc=aron@Zambeel.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®