So I was reading How Linux Works by Brian Ward. In it, he says, the user-space applications going bad will not wreck the system.
Figure 1-1. General Linux system organization There is a critical difference between the ways that the kernel and user processes run: The kernel runs in kernel mode, and the user processes run in user mode. Code running in kernel mode has unrestricted access to the processor and main memory. This is a powerful but dangerous privilege that allows a kernel process to easily crash the entire system. The area that only the kernel can access is called kernel space.
User mode, in comparison, restricts access to a (usually quite small) subset of memory and safe CPU operations. User space refers to the parts of main memory that the user processes can access. If a process makes a mistake and crashes, the consequences are limited and can be cleaned up by the kernel. This means that if your web browser crashes, it probably won’t take down the scientific computation that you’ve been running in the background for days.
In theory, a user process gone haywire can’t cause serious damage to the rest of the system. In reality, it depends on what you consider “serious damage,” as well as the particular privileges of the process, because some processes are allowed to do more than others. For example, can a user process completely wreck the data on a disk? With the correct permissions, yes—and you may consider this to be fairly dangerous. There are safeguards to prevent this, however, and most processes simply aren’t allowed to wreak havoc in this manner.
I have read that a web server, for example, runs in user-space and I have seen it consuming all the memory of the system and forcing the server to be crashed. But what the author says is contradicting to this.
I don't know if I am misinterpreting what the author is trying to say. My apologies.
Can someone please explain if the userspace applications can wreck the system or not and why.
Thanks for your humble help.
/proc/pid/oom_score
. The OOM killer isn't guaranteed to go after the troublesome program, especially where that program is composed of many smaller processes. – Philip Couling Jun 13 '19 at 06:59