From: "Roy Lee" <roylee17@gmail.com>
To: <linux-kernel@vger.kernel.org>
Subject: A question about sceduling
Date: Fri, 16 Sep 2005 15:15:58 +0800 [thread overview]
Message-ID: <432a7132.75a05f0c.10f5.ffffb719@mx.gmail.com> (raw)
I'm tracing the scheduling code of 2.6.12.
During the process creation, the parent process would let the child process
execute first to avoid the COW overhead.
In wake_up_new_task():
if (!(clone_flags & CLONE_VM)) {
/*
* The VM isn't cloned, so we're in a good position to
* do child-runs-first in anticipation of an exec. This
* usually avoids a lot of COW overhead.
*/
if (unlikely(!current->array))
__activate_task(p, rq);
else {
p->prio = current->prio;
list_add_tail(&p->run_list, ¤t->run_list);
p->array = current->array;
p->array->nr_active++;
rq->nr_running++;
}
set_need_resched();
It sets the flag to notify the kernel to reschedule.
But, the child has the same priority as it's parent and is the at the "tail"
of that priority queue.
What makes the scheduler choose the child to run before the parent?
I couldn't' find the point where the parent goes to sleep voluntarily, or
when did the scheduler put the parent behind the child.
Many Thanks
--
Roy
next reply other threads:[~2005-09-16 7:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-16 7:15 Roy Lee [this message]
2005-09-16 8:54 Zhang, Yanmin
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=432a7132.75a05f0c.10f5.ffffb719@mx.gmail.com \
--to=roylee17@gmail.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®