How can I add parameters to the Linux Kernel scheduler?












0














I am learning to work with Linux kernel. Currently I am using 4.15.0-36-generic.



I understood that the schedulers after version 2.6 use a completely fair scheduler. I also came to know that, the implementation uses virtual runtime(v_runtime) for priority updation of a process.



Theoretically, after the the process has a virtual runtime of t, the update is done as



v_runtime += t * (w).



This weight w is said to be a function of the NICE value of the process. It is here, that I want to add one more parameter. I want this w to be a function of NICE value, and another parameter for a given process. The rest of the scheduling algorithm can remain same for the moment.



I cloned the Linux code, and checked out the scheduler code and documentation. I could not locate the point where I could make the change.



I have my own model to give these parameters to a program. You can think of it as a reputation based value.










share|improve this question















migrated from unix.stackexchange.com Nov 14 '18 at 16:35


This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems.















  • Dynamic priority (as used by the default scheduler) is also based on reputation. Linux has at least 4 schedulers already, so should be easy to add another.
    – ctrl-alt-delor
    Nov 18 '18 at 14:38










  • I have added your comment to the question.
    – ctrl-alt-delor
    Nov 18 '18 at 14:40










  • I think I have a working solution. I went through the Linux kernel code 4.19.2, and have summed it up in the answer at the given link. [unix.stackexchange.com/questions/482479/…
    – Nikhilesh Singh
    Nov 21 '18 at 8:49










  • However, the above link discusses the priority assignment when a new process is created, changing it dynamically may require an alternate approach.
    – Nikhilesh Singh
    Nov 21 '18 at 8:51
















0














I am learning to work with Linux kernel. Currently I am using 4.15.0-36-generic.



I understood that the schedulers after version 2.6 use a completely fair scheduler. I also came to know that, the implementation uses virtual runtime(v_runtime) for priority updation of a process.



Theoretically, after the the process has a virtual runtime of t, the update is done as



v_runtime += t * (w).



This weight w is said to be a function of the NICE value of the process. It is here, that I want to add one more parameter. I want this w to be a function of NICE value, and another parameter for a given process. The rest of the scheduling algorithm can remain same for the moment.



I cloned the Linux code, and checked out the scheduler code and documentation. I could not locate the point where I could make the change.



I have my own model to give these parameters to a program. You can think of it as a reputation based value.










share|improve this question















migrated from unix.stackexchange.com Nov 14 '18 at 16:35


This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems.















  • Dynamic priority (as used by the default scheduler) is also based on reputation. Linux has at least 4 schedulers already, so should be easy to add another.
    – ctrl-alt-delor
    Nov 18 '18 at 14:38










  • I have added your comment to the question.
    – ctrl-alt-delor
    Nov 18 '18 at 14:40










  • I think I have a working solution. I went through the Linux kernel code 4.19.2, and have summed it up in the answer at the given link. [unix.stackexchange.com/questions/482479/…
    – Nikhilesh Singh
    Nov 21 '18 at 8:49










  • However, the above link discusses the priority assignment when a new process is created, changing it dynamically may require an alternate approach.
    – Nikhilesh Singh
    Nov 21 '18 at 8:51














0












0








0







I am learning to work with Linux kernel. Currently I am using 4.15.0-36-generic.



I understood that the schedulers after version 2.6 use a completely fair scheduler. I also came to know that, the implementation uses virtual runtime(v_runtime) for priority updation of a process.



Theoretically, after the the process has a virtual runtime of t, the update is done as



v_runtime += t * (w).



This weight w is said to be a function of the NICE value of the process. It is here, that I want to add one more parameter. I want this w to be a function of NICE value, and another parameter for a given process. The rest of the scheduling algorithm can remain same for the moment.



I cloned the Linux code, and checked out the scheduler code and documentation. I could not locate the point where I could make the change.



I have my own model to give these parameters to a program. You can think of it as a reputation based value.










share|improve this question















I am learning to work with Linux kernel. Currently I am using 4.15.0-36-generic.



I understood that the schedulers after version 2.6 use a completely fair scheduler. I also came to know that, the implementation uses virtual runtime(v_runtime) for priority updation of a process.



Theoretically, after the the process has a virtual runtime of t, the update is done as



v_runtime += t * (w).



This weight w is said to be a function of the NICE value of the process. It is here, that I want to add one more parameter. I want this w to be a function of NICE value, and another parameter for a given process. The rest of the scheduling algorithm can remain same for the moment.



I cloned the Linux code, and checked out the scheduler code and documentation. I could not locate the point where I could make the change.



I have my own model to give these parameters to a program. You can think of it as a reputation based value.







linux linux-kernel scheduling






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 18 '18 at 14:39









ctrl-alt-delor

4,14732443




4,14732443










asked Nov 14 '18 at 14:39









Nikhilesh Singh

114




114




migrated from unix.stackexchange.com Nov 14 '18 at 16:35


This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems.






migrated from unix.stackexchange.com Nov 14 '18 at 16:35


This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems.














  • Dynamic priority (as used by the default scheduler) is also based on reputation. Linux has at least 4 schedulers already, so should be easy to add another.
    – ctrl-alt-delor
    Nov 18 '18 at 14:38










  • I have added your comment to the question.
    – ctrl-alt-delor
    Nov 18 '18 at 14:40










  • I think I have a working solution. I went through the Linux kernel code 4.19.2, and have summed it up in the answer at the given link. [unix.stackexchange.com/questions/482479/…
    – Nikhilesh Singh
    Nov 21 '18 at 8:49










  • However, the above link discusses the priority assignment when a new process is created, changing it dynamically may require an alternate approach.
    – Nikhilesh Singh
    Nov 21 '18 at 8:51


















  • Dynamic priority (as used by the default scheduler) is also based on reputation. Linux has at least 4 schedulers already, so should be easy to add another.
    – ctrl-alt-delor
    Nov 18 '18 at 14:38










  • I have added your comment to the question.
    – ctrl-alt-delor
    Nov 18 '18 at 14:40










  • I think I have a working solution. I went through the Linux kernel code 4.19.2, and have summed it up in the answer at the given link. [unix.stackexchange.com/questions/482479/…
    – Nikhilesh Singh
    Nov 21 '18 at 8:49










  • However, the above link discusses the priority assignment when a new process is created, changing it dynamically may require an alternate approach.
    – Nikhilesh Singh
    Nov 21 '18 at 8:51
















Dynamic priority (as used by the default scheduler) is also based on reputation. Linux has at least 4 schedulers already, so should be easy to add another.
– ctrl-alt-delor
Nov 18 '18 at 14:38




Dynamic priority (as used by the default scheduler) is also based on reputation. Linux has at least 4 schedulers already, so should be easy to add another.
– ctrl-alt-delor
Nov 18 '18 at 14:38












I have added your comment to the question.
– ctrl-alt-delor
Nov 18 '18 at 14:40




I have added your comment to the question.
– ctrl-alt-delor
Nov 18 '18 at 14:40












I think I have a working solution. I went through the Linux kernel code 4.19.2, and have summed it up in the answer at the given link. [unix.stackexchange.com/questions/482479/…
– Nikhilesh Singh
Nov 21 '18 at 8:49




I think I have a working solution. I went through the Linux kernel code 4.19.2, and have summed it up in the answer at the given link. [unix.stackexchange.com/questions/482479/…
– Nikhilesh Singh
Nov 21 '18 at 8:49












However, the above link discusses the priority assignment when a new process is created, changing it dynamically may require an alternate approach.
– Nikhilesh Singh
Nov 21 '18 at 8:51




However, the above link discusses the priority assignment when a new process is created, changing it dynamically may require an alternate approach.
– Nikhilesh Singh
Nov 21 '18 at 8:51












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53304868%2fhow-can-i-add-parameters-to-the-linux-kernel-scheduler%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53304868%2fhow-can-i-add-parameters-to-the-linux-kernel-scheduler%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)