What happens if a Linux distro is installed with no swap and when itâÂÂs almost out of RAM executes a new application? [duplicate]

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
This question already has an answer here:
Will Linux start killing my processes without asking me if memory gets short?
2 answers
What happens if a Linux, letâÂÂs say Arch Linux or Debian, is installed with no swap partition or swap file. Then, when running the OS while almost out of RAM, the user opens a new application. Considering that this new application needs more RAM memory than whatâÂÂs needed, what will happen?
What part of the operating system handles RAM management operations, and can I configure it to behave differently?
memory ram out-of-memory memory-management
marked as duplicate by Patrick, Bratchley, Romeo Ninov, Kiwy, Jesse_b May 2 at 16:14
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
0
down vote
favorite
This question already has an answer here:
Will Linux start killing my processes without asking me if memory gets short?
2 answers
What happens if a Linux, letâÂÂs say Arch Linux or Debian, is installed with no swap partition or swap file. Then, when running the OS while almost out of RAM, the user opens a new application. Considering that this new application needs more RAM memory than whatâÂÂs needed, what will happen?
What part of the operating system handles RAM management operations, and can I configure it to behave differently?
memory ram out-of-memory memory-management
marked as duplicate by Patrick, Bratchley, Romeo Ninov, Kiwy, Jesse_b May 2 at 16:14
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
See here for the answer to your second question about configuration: kernel.org/doc/Documentation/vm
â Patrick
Apr 29 at 14:52
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
Will Linux start killing my processes without asking me if memory gets short?
2 answers
What happens if a Linux, letâÂÂs say Arch Linux or Debian, is installed with no swap partition or swap file. Then, when running the OS while almost out of RAM, the user opens a new application. Considering that this new application needs more RAM memory than whatâÂÂs needed, what will happen?
What part of the operating system handles RAM management operations, and can I configure it to behave differently?
memory ram out-of-memory memory-management
This question already has an answer here:
Will Linux start killing my processes without asking me if memory gets short?
2 answers
What happens if a Linux, letâÂÂs say Arch Linux or Debian, is installed with no swap partition or swap file. Then, when running the OS while almost out of RAM, the user opens a new application. Considering that this new application needs more RAM memory than whatâÂÂs needed, what will happen?
What part of the operating system handles RAM management operations, and can I configure it to behave differently?
This question already has an answer here:
Will Linux start killing my processes without asking me if memory gets short?
2 answers
memory ram out-of-memory memory-management
edited May 2 at 2:24
G-Man
11.5k82656
11.5k82656
asked Apr 29 at 14:24
eye
31
31
marked as duplicate by Patrick, Bratchley, Romeo Ninov, Kiwy, Jesse_b May 2 at 16:14
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Patrick, Bratchley, Romeo Ninov, Kiwy, Jesse_b May 2 at 16:14
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
See here for the answer to your second question about configuration: kernel.org/doc/Documentation/vm
â Patrick
Apr 29 at 14:52
add a comment |Â
See here for the answer to your second question about configuration: kernel.org/doc/Documentation/vm
â Patrick
Apr 29 at 14:52
See here for the answer to your second question about configuration: kernel.org/doc/Documentation/vm
â Patrick
Apr 29 at 14:52
See here for the answer to your second question about configuration: kernel.org/doc/Documentation/vm
â Patrick
Apr 29 at 14:52
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
2
down vote
accepted
The Linux kernel has a component called the OOM killer (out of memory). As Patrick pointed out in the comments the OOM killer can be disabled but the default setting is to allow overcommit (and thus enable the OOM killer).
Applications ask the kernel for more memory and the kernel can refuse to give it to them (because there is not enough memory or because ulimit has been used to deny more memory to the process). If overcommit is enabled then an application has asked for some memory and was granted the amount but if the application writes to a new memory page (for the first time) and the kernel actually has to allocate memory for this but cannot do that then the kernel has to decide which process to kill in order to free memory.
The kernel will rather kill new processes than old ones, especially those who (together with their children) consume much memory. So in your case the new process might start but would probably be the one which gets killed.
You can use the files
/proc/self/oom_adj
/proc/self/oom_score
/proc/self/oom_score_adj
to check the current settings and to tell the kernel in which order it shall kill processes if necessary.
This is only if overcommit is enabled. If the sysctlvm.overcommit_memoryis2, the OOM killer is disabled.
â Patrick
Apr 29 at 14:51
add a comment |Â
up vote
0
down vote
Keep in mind that the kernel can toss out text pages to make more room in memory. Text pages are memory that contains executable code. This can cause a kind of thrashing, as pages are tossed out and subsequently loaded from executables on disk.
add a comment |Â
up vote
0
down vote
Hauke LagingâÂÂs answer focuses on the âÂÂout of memoryâ processes killer,
and barely mentions the fact that things can simply fail.ÃÂ
You mention a scenario in which âÂÂthe user opens a new applicationâÂÂ.ÃÂ
The standard mechanism for âÂÂa new applicationâ being opened
is for some process (typically a shell or a window manager) to âÂÂforkâÂÂ,
to create a new process that is a copy of the existing one,
and for the new process to call âÂÂexecâÂÂ,
to replace itself with the new program.ÃÂ
Either can fail for lack of memory.
From fork(2):
ERRORS
(i.e., list of possible failure conditions)
âÂÂâÂÂâÂÂï¸Â
ENOMEM
fork() failed to allocate the necessary kernel structures
because memory is tight.âÂÂâÂÂâÂÂï¸Â
And similarly execve(2):
â
âÂÂâÂÂâÂÂï¸Â
ENOMEM
Insufficient kernel memory was available.
âÂÂâÂÂâÂÂï¸Â
This Google search shows other system functions
that can return the âÂÂENOMEMâ error.
So itâÂÂs possible that you (the user) will simply get an error message
when you try to start a new program running,
or otherwise initiate a new activity, when memory is low.
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
The Linux kernel has a component called the OOM killer (out of memory). As Patrick pointed out in the comments the OOM killer can be disabled but the default setting is to allow overcommit (and thus enable the OOM killer).
Applications ask the kernel for more memory and the kernel can refuse to give it to them (because there is not enough memory or because ulimit has been used to deny more memory to the process). If overcommit is enabled then an application has asked for some memory and was granted the amount but if the application writes to a new memory page (for the first time) and the kernel actually has to allocate memory for this but cannot do that then the kernel has to decide which process to kill in order to free memory.
The kernel will rather kill new processes than old ones, especially those who (together with their children) consume much memory. So in your case the new process might start but would probably be the one which gets killed.
You can use the files
/proc/self/oom_adj
/proc/self/oom_score
/proc/self/oom_score_adj
to check the current settings and to tell the kernel in which order it shall kill processes if necessary.
This is only if overcommit is enabled. If the sysctlvm.overcommit_memoryis2, the OOM killer is disabled.
â Patrick
Apr 29 at 14:51
add a comment |Â
up vote
2
down vote
accepted
The Linux kernel has a component called the OOM killer (out of memory). As Patrick pointed out in the comments the OOM killer can be disabled but the default setting is to allow overcommit (and thus enable the OOM killer).
Applications ask the kernel for more memory and the kernel can refuse to give it to them (because there is not enough memory or because ulimit has been used to deny more memory to the process). If overcommit is enabled then an application has asked for some memory and was granted the amount but if the application writes to a new memory page (for the first time) and the kernel actually has to allocate memory for this but cannot do that then the kernel has to decide which process to kill in order to free memory.
The kernel will rather kill new processes than old ones, especially those who (together with their children) consume much memory. So in your case the new process might start but would probably be the one which gets killed.
You can use the files
/proc/self/oom_adj
/proc/self/oom_score
/proc/self/oom_score_adj
to check the current settings and to tell the kernel in which order it shall kill processes if necessary.
This is only if overcommit is enabled. If the sysctlvm.overcommit_memoryis2, the OOM killer is disabled.
â Patrick
Apr 29 at 14:51
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
The Linux kernel has a component called the OOM killer (out of memory). As Patrick pointed out in the comments the OOM killer can be disabled but the default setting is to allow overcommit (and thus enable the OOM killer).
Applications ask the kernel for more memory and the kernel can refuse to give it to them (because there is not enough memory or because ulimit has been used to deny more memory to the process). If overcommit is enabled then an application has asked for some memory and was granted the amount but if the application writes to a new memory page (for the first time) and the kernel actually has to allocate memory for this but cannot do that then the kernel has to decide which process to kill in order to free memory.
The kernel will rather kill new processes than old ones, especially those who (together with their children) consume much memory. So in your case the new process might start but would probably be the one which gets killed.
You can use the files
/proc/self/oom_adj
/proc/self/oom_score
/proc/self/oom_score_adj
to check the current settings and to tell the kernel in which order it shall kill processes if necessary.
The Linux kernel has a component called the OOM killer (out of memory). As Patrick pointed out in the comments the OOM killer can be disabled but the default setting is to allow overcommit (and thus enable the OOM killer).
Applications ask the kernel for more memory and the kernel can refuse to give it to them (because there is not enough memory or because ulimit has been used to deny more memory to the process). If overcommit is enabled then an application has asked for some memory and was granted the amount but if the application writes to a new memory page (for the first time) and the kernel actually has to allocate memory for this but cannot do that then the kernel has to decide which process to kill in order to free memory.
The kernel will rather kill new processes than old ones, especially those who (together with their children) consume much memory. So in your case the new process might start but would probably be the one which gets killed.
You can use the files
/proc/self/oom_adj
/proc/self/oom_score
/proc/self/oom_score_adj
to check the current settings and to tell the kernel in which order it shall kill processes if necessary.
edited May 5 at 13:19
answered Apr 29 at 14:31
Hauke Laging
53.2k1282130
53.2k1282130
This is only if overcommit is enabled. If the sysctlvm.overcommit_memoryis2, the OOM killer is disabled.
â Patrick
Apr 29 at 14:51
add a comment |Â
This is only if overcommit is enabled. If the sysctlvm.overcommit_memoryis2, the OOM killer is disabled.
â Patrick
Apr 29 at 14:51
This is only if overcommit is enabled. If the sysctl
vm.overcommit_memory is 2, the OOM killer is disabled.â Patrick
Apr 29 at 14:51
This is only if overcommit is enabled. If the sysctl
vm.overcommit_memory is 2, the OOM killer is disabled.â Patrick
Apr 29 at 14:51
add a comment |Â
up vote
0
down vote
Keep in mind that the kernel can toss out text pages to make more room in memory. Text pages are memory that contains executable code. This can cause a kind of thrashing, as pages are tossed out and subsequently loaded from executables on disk.
add a comment |Â
up vote
0
down vote
Keep in mind that the kernel can toss out text pages to make more room in memory. Text pages are memory that contains executable code. This can cause a kind of thrashing, as pages are tossed out and subsequently loaded from executables on disk.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Keep in mind that the kernel can toss out text pages to make more room in memory. Text pages are memory that contains executable code. This can cause a kind of thrashing, as pages are tossed out and subsequently loaded from executables on disk.
Keep in mind that the kernel can toss out text pages to make more room in memory. Text pages are memory that contains executable code. This can cause a kind of thrashing, as pages are tossed out and subsequently loaded from executables on disk.
answered Apr 29 at 17:17
casualunixer
4651716
4651716
add a comment |Â
add a comment |Â
up vote
0
down vote
Hauke LagingâÂÂs answer focuses on the âÂÂout of memoryâ processes killer,
and barely mentions the fact that things can simply fail.ÃÂ
You mention a scenario in which âÂÂthe user opens a new applicationâÂÂ.ÃÂ
The standard mechanism for âÂÂa new applicationâ being opened
is for some process (typically a shell or a window manager) to âÂÂforkâÂÂ,
to create a new process that is a copy of the existing one,
and for the new process to call âÂÂexecâÂÂ,
to replace itself with the new program.ÃÂ
Either can fail for lack of memory.
From fork(2):
ERRORS
(i.e., list of possible failure conditions)
âÂÂâÂÂâÂÂï¸Â
ENOMEM
fork() failed to allocate the necessary kernel structures
because memory is tight.âÂÂâÂÂâÂÂï¸Â
And similarly execve(2):
â
âÂÂâÂÂâÂÂï¸Â
ENOMEM
Insufficient kernel memory was available.
âÂÂâÂÂâÂÂï¸Â
This Google search shows other system functions
that can return the âÂÂENOMEMâ error.
So itâÂÂs possible that you (the user) will simply get an error message
when you try to start a new program running,
or otherwise initiate a new activity, when memory is low.
add a comment |Â
up vote
0
down vote
Hauke LagingâÂÂs answer focuses on the âÂÂout of memoryâ processes killer,
and barely mentions the fact that things can simply fail.ÃÂ
You mention a scenario in which âÂÂthe user opens a new applicationâÂÂ.ÃÂ
The standard mechanism for âÂÂa new applicationâ being opened
is for some process (typically a shell or a window manager) to âÂÂforkâÂÂ,
to create a new process that is a copy of the existing one,
and for the new process to call âÂÂexecâÂÂ,
to replace itself with the new program.ÃÂ
Either can fail for lack of memory.
From fork(2):
ERRORS
(i.e., list of possible failure conditions)
âÂÂâÂÂâÂÂï¸Â
ENOMEM
fork() failed to allocate the necessary kernel structures
because memory is tight.âÂÂâÂÂâÂÂï¸Â
And similarly execve(2):
â
âÂÂâÂÂâÂÂï¸Â
ENOMEM
Insufficient kernel memory was available.
âÂÂâÂÂâÂÂï¸Â
This Google search shows other system functions
that can return the âÂÂENOMEMâ error.
So itâÂÂs possible that you (the user) will simply get an error message
when you try to start a new program running,
or otherwise initiate a new activity, when memory is low.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Hauke LagingâÂÂs answer focuses on the âÂÂout of memoryâ processes killer,
and barely mentions the fact that things can simply fail.ÃÂ
You mention a scenario in which âÂÂthe user opens a new applicationâÂÂ.ÃÂ
The standard mechanism for âÂÂa new applicationâ being opened
is for some process (typically a shell or a window manager) to âÂÂforkâÂÂ,
to create a new process that is a copy of the existing one,
and for the new process to call âÂÂexecâÂÂ,
to replace itself with the new program.ÃÂ
Either can fail for lack of memory.
From fork(2):
ERRORS
(i.e., list of possible failure conditions)
âÂÂâÂÂâÂÂï¸Â
ENOMEM
fork() failed to allocate the necessary kernel structures
because memory is tight.âÂÂâÂÂâÂÂï¸Â
And similarly execve(2):
â
âÂÂâÂÂâÂÂï¸Â
ENOMEM
Insufficient kernel memory was available.
âÂÂâÂÂâÂÂï¸Â
This Google search shows other system functions
that can return the âÂÂENOMEMâ error.
So itâÂÂs possible that you (the user) will simply get an error message
when you try to start a new program running,
or otherwise initiate a new activity, when memory is low.
Hauke LagingâÂÂs answer focuses on the âÂÂout of memoryâ processes killer,
and barely mentions the fact that things can simply fail.ÃÂ
You mention a scenario in which âÂÂthe user opens a new applicationâÂÂ.ÃÂ
The standard mechanism for âÂÂa new applicationâ being opened
is for some process (typically a shell or a window manager) to âÂÂforkâÂÂ,
to create a new process that is a copy of the existing one,
and for the new process to call âÂÂexecâÂÂ,
to replace itself with the new program.ÃÂ
Either can fail for lack of memory.
From fork(2):
ERRORS
(i.e., list of possible failure conditions)
âÂÂâÂÂâÂÂï¸Â
ENOMEM
fork() failed to allocate the necessary kernel structures
because memory is tight.âÂÂâÂÂâÂÂï¸Â
And similarly execve(2):
â
âÂÂâÂÂâÂÂï¸Â
ENOMEM
Insufficient kernel memory was available.
âÂÂâÂÂâÂÂï¸Â
This Google search shows other system functions
that can return the âÂÂENOMEMâ error.
So itâÂÂs possible that you (the user) will simply get an error message
when you try to start a new program running,
or otherwise initiate a new activity, when memory is low.
answered May 2 at 2:12
G-Man
11.5k82656
11.5k82656
add a comment |Â
add a comment |Â
See here for the answer to your second question about configuration: kernel.org/doc/Documentation/vm
â Patrick
Apr 29 at 14:52