How set the âoom_score_adjâ when(before) run target program?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
Directly set by echo 1000 >/proc/<pid>/oom_score_adj
is unreliable because target program is already running , in this case maybe target program caused OOM before echo 1000 >/proc/<pid>/oom_score_adj
linux debian out-of-memory
add a comment |Â
up vote
1
down vote
favorite
Directly set by echo 1000 >/proc/<pid>/oom_score_adj
is unreliable because target program is already running , in this case maybe target program caused OOM before echo 1000 >/proc/<pid>/oom_score_adj
linux debian out-of-memory
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Directly set by echo 1000 >/proc/<pid>/oom_score_adj
is unreliable because target program is already running , in this case maybe target program caused OOM before echo 1000 >/proc/<pid>/oom_score_adj
linux debian out-of-memory
Directly set by echo 1000 >/proc/<pid>/oom_score_adj
is unreliable because target program is already running , in this case maybe target program caused OOM before echo 1000 >/proc/<pid>/oom_score_adj
linux debian out-of-memory
asked Dec 7 '17 at 8:14
illiterate
1259
1259
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
oom_score_adj
is inherited on fork, so you can set its initial value for new children by setting the desired value on the parent process.
Thus if youâÂÂre starting the target from a shell script,
echo 1000 > /proc/$$/oom_score_adj
will change the shellâÂÂs value to 1000, and any process subsequently forked by the shell will start with oom_score_adj
set to 1000.
add a comment |Â
up vote
0
down vote
As an alternative to setting it on the parent process, as in M. Kitt's answer, one can set it on the child process after the fork by running the program in the child process via a chain-loading tool that imposes the setting on itself and then simply chain loads the target program.
I wrote one such utility for the nosh toolset in 2016, that knows the mechanisms for both Linux operating systems and FreeBSD/TrueOS.
oom-kill-protect -- 1000 target-program some-arguments
The --
is there for when someone decides to adapt that to use a negative OOM score. âº
Further reading
- Jonathan de Boyne Pollard (2016).
oom-kill-protect
. nosh toolset.
Softwares. - Jonathan de Boyne Pollard (2016-01-31). syslogd(8) with OOM Killer protection. FreeBSD Hackers.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
oom_score_adj
is inherited on fork, so you can set its initial value for new children by setting the desired value on the parent process.
Thus if youâÂÂre starting the target from a shell script,
echo 1000 > /proc/$$/oom_score_adj
will change the shellâÂÂs value to 1000, and any process subsequently forked by the shell will start with oom_score_adj
set to 1000.
add a comment |Â
up vote
1
down vote
accepted
oom_score_adj
is inherited on fork, so you can set its initial value for new children by setting the desired value on the parent process.
Thus if youâÂÂre starting the target from a shell script,
echo 1000 > /proc/$$/oom_score_adj
will change the shellâÂÂs value to 1000, and any process subsequently forked by the shell will start with oom_score_adj
set to 1000.
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
oom_score_adj
is inherited on fork, so you can set its initial value for new children by setting the desired value on the parent process.
Thus if youâÂÂre starting the target from a shell script,
echo 1000 > /proc/$$/oom_score_adj
will change the shellâÂÂs value to 1000, and any process subsequently forked by the shell will start with oom_score_adj
set to 1000.
oom_score_adj
is inherited on fork, so you can set its initial value for new children by setting the desired value on the parent process.
Thus if youâÂÂre starting the target from a shell script,
echo 1000 > /proc/$$/oom_score_adj
will change the shellâÂÂs value to 1000, and any process subsequently forked by the shell will start with oom_score_adj
set to 1000.
edited Dec 7 '17 at 9:50
answered Dec 7 '17 at 9:16
Stephen Kitt
143k22310374
143k22310374
add a comment |Â
add a comment |Â
up vote
0
down vote
As an alternative to setting it on the parent process, as in M. Kitt's answer, one can set it on the child process after the fork by running the program in the child process via a chain-loading tool that imposes the setting on itself and then simply chain loads the target program.
I wrote one such utility for the nosh toolset in 2016, that knows the mechanisms for both Linux operating systems and FreeBSD/TrueOS.
oom-kill-protect -- 1000 target-program some-arguments
The --
is there for when someone decides to adapt that to use a negative OOM score. âº
Further reading
- Jonathan de Boyne Pollard (2016).
oom-kill-protect
. nosh toolset.
Softwares. - Jonathan de Boyne Pollard (2016-01-31). syslogd(8) with OOM Killer protection. FreeBSD Hackers.
add a comment |Â
up vote
0
down vote
As an alternative to setting it on the parent process, as in M. Kitt's answer, one can set it on the child process after the fork by running the program in the child process via a chain-loading tool that imposes the setting on itself and then simply chain loads the target program.
I wrote one such utility for the nosh toolset in 2016, that knows the mechanisms for both Linux operating systems and FreeBSD/TrueOS.
oom-kill-protect -- 1000 target-program some-arguments
The --
is there for when someone decides to adapt that to use a negative OOM score. âº
Further reading
- Jonathan de Boyne Pollard (2016).
oom-kill-protect
. nosh toolset.
Softwares. - Jonathan de Boyne Pollard (2016-01-31). syslogd(8) with OOM Killer protection. FreeBSD Hackers.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
As an alternative to setting it on the parent process, as in M. Kitt's answer, one can set it on the child process after the fork by running the program in the child process via a chain-loading tool that imposes the setting on itself and then simply chain loads the target program.
I wrote one such utility for the nosh toolset in 2016, that knows the mechanisms for both Linux operating systems and FreeBSD/TrueOS.
oom-kill-protect -- 1000 target-program some-arguments
The --
is there for when someone decides to adapt that to use a negative OOM score. âº
Further reading
- Jonathan de Boyne Pollard (2016).
oom-kill-protect
. nosh toolset.
Softwares. - Jonathan de Boyne Pollard (2016-01-31). syslogd(8) with OOM Killer protection. FreeBSD Hackers.
As an alternative to setting it on the parent process, as in M. Kitt's answer, one can set it on the child process after the fork by running the program in the child process via a chain-loading tool that imposes the setting on itself and then simply chain loads the target program.
I wrote one such utility for the nosh toolset in 2016, that knows the mechanisms for both Linux operating systems and FreeBSD/TrueOS.
oom-kill-protect -- 1000 target-program some-arguments
The --
is there for when someone decides to adapt that to use a negative OOM score. âº
Further reading
- Jonathan de Boyne Pollard (2016).
oom-kill-protect
. nosh toolset.
Softwares. - Jonathan de Boyne Pollard (2016-01-31). syslogd(8) with OOM Killer protection. FreeBSD Hackers.
answered Dec 7 '17 at 11:48
JdeBP
28.7k459134
28.7k459134
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409416%2fhow-set-the-oom-score-adj-whenbefore-run-target-program%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password