<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 15, 2016 at 7:37 PM, Nitin Varyani <span dir="ltr"><<a href="mailto:varyani.nitin1@gmail.com" target="_blank">varyani.nitin1@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 15, 2016 at 6:06 PM, Nitin Varyani <span dir="ltr"><<a href="mailto:varyani.nitin1@gmail.com" target="_blank">varyani.nitin1@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi<br></div> I have studied LInux kernel CFS scheduling algorithm - the vruntime, weights, nice value, etc. I am able to understand the code. <br> Actually the task given to me is really very huge. I am told to design a distributed process scheduling algorithm. A very simple implementation of it will be sufficient for me. Current distributed OS are patch work over the linux kernels, that is, they are responsible for load balancing through process migration but the scheduling is taken care by the single machine linux kernels. My task is to make the scheduling algorithm itself as distributed. That is a scheduler makes a decision whether to migrate a task or to keep the task in the current system. I need some design aspects of how to achieve it. Another thing which I want to know is that whether this job is possible for a kernel newbie like me.<br></div><div><div class="h5"><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 13, 2016 at 3:12 PM, Nitin Varyani <span dir="ltr"><<a href="mailto:varyani.nitin1@gmail.com" target="_blank">varyani.nitin1@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">thanks</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 13, 2016 at 2:19 PM, Henrik Austad <span dir="ltr"><<a href="mailto:henrik@austad.us" target="_blank">henrik@austad.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sat, Feb 13, 2016 at 11:42:57AM +0530, Nitin Varyani wrote:<br>
> Hello,<br>
<br>
Hi Nitin,<br>
<span><br>
> I want to understand the flow of code of process scheduler of<br>
> linux kernel. What I have understood is that<br>
> The task marks itself as sleeping,<br>
> puts itself on a wait queue,<br>
> removes itself from the red-black tree of runnable, and<br>
> calls schedule() to select a new process to execute.<br>
><br>
> for Waking back up<br>
> The task is set as runnable,<br>
> removed from the wait queue,<br>
> and added back to the red-black tree.<br>
><br>
> Can I get the details of which function does what? in sched/core.c and in<br>
> sched/fair.c<br>
> I am concerned only with fair scheduler. There are so many functions in<br>
> these two files that I am totally confused.<br>
<br>
</span>Then core.c and fair.c is the best bet.<br>
<br>
You could also pick up a copy of Linux kernel development (By Love), it<br>
gives a nice introduction to the overall flow of .. well mostly everything.<br>
:)<br>
<br>
In kernel/sched/sched.h you have a struct called 'struct sched_class" which<br>
is a set of function-points. This is used by the core machinery to call<br>
into scheduling-class specific code. At the bottom of fair.c, you see said<br>
struct being populated.<br>
<br>
Also, if you want to see what really happens, try enabling<br>
function-tracing, but limit it to sched-functions only (and sched-events,<br>
those are also useful to see what triggers things)<br>
<br>
mount -t debugfs nodev /sys/kernel/debug<br>
cd /sys/kernel/debug/tracing<br>
echo 0 > tracing_on<br>
echo function > current_tracer<br>
echo "sched*" > set_ftrace_filter<br>
echo 1 > events/sched/enable<br>
echo 1 > tracing_on<br>
... wait for a few secs<br>
echo 0 > tracing_on<br>
<br>
cat trace > /tmp/trace.txt<br>
<br>
Now, look at trace.txt and correlate it to the scheduler code :)<br>
<br>
Good luck!<br>
<span><font color="#888888"><br>
--<br>
Henrik Austad<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></div></div></blockquote></div><br></div></div>
<br></blockquote></div><br><br></div><div class="gmail_extra">Please don't top post :) Use bottom post .<br><br></div><div class="gmail_extra">Sounds like what you're going to do is highly similar to openMosix. check their source code.<br><br></div><div class="gmail_extra">Please note that openmosix is patch against 2.4.x linux kernel. When they're about to made it compatible to 2.6.x, the project stalls. See Linux IPMI project and see if you can help them out<br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature">regards,<br><br>Mulyadi Santosa<br>Freelance Linux trainer and consultant<br><br>blog: <a href="http://the-hydra.blogspot.com" target="_blank">the-hydra.blogspot.com</a><br>training: <a href="http://mulyaditraining.blogspot.com" target="_blank">mulyaditraining.blogspot.com</a></div>
</div></div><div id="DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top:1px solid #aaabb6">
        <tr>
                <td style="width:470px;padding-top:20px;color:#41424e;font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">This email has been sent from a virus-free computer protected by Avast. <br><a href="https://www.avast.com/sig-email" target="_blank" style="color:#4453ea">www.avast.com</a>
                </td>
        </tr>
</table><a href="#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"></a></div>