0

So I have a mission critical though not-at-all resource intensive node.js program continuously running 24/7 in one terminal on an Ubuntu 18 virtualbox, and I need to use one or two additional terminals for dev work and research. Eventually I will have the first program on a cloud VPS or second machine, but for now it is on my primary workstation.

I am a novice at this, so please forgive my asking, but:

  1. Are the multiple terminals completely sandboxed?

  2. If I am running a CPU/Memory intensive operation on a second terminal, will it an any way interfere with the first terminal, aside from using overall resources?

  3. Is there a good way to prioritize Network, CPU, and Memory resources for the mission critical terminal?

jmxdbx
  • 1
  • I'd suggest you use screen and have your program run in a screen session, so you shouldn't need one terminal constantly open. As for resources, you might consider tuning niceness value https://askubuntu.com/q/48708/295286 so that CPU gives preference to that particular program – Sergiy Kolodyazhnyy Jul 29 '18 at 20:00

1 Answers1

1

"Terminals" themselves are not the node process that's actually doing the work. The output you see on the terminal you see are merely a representation of the stdin and stdout of the process.

The process itself will be called node and it's functioning is not directly linked to the terminal except that when the terminal is closed ( i.e SIGHUP is sent to the process since it's the child of the terminal ), the process is shut down, since the terminal created the process by forking itself and replacing its contents with your node application. This can be circumvented by adding an & to the end of the command (which makes it ignore SIGHUP) or running your command inside a screen or tmux session (recommended since you can easily connect back)

Hence to answer your questions

  1. Since terminals don't really "contain" your process, there isn't really any isolation between them. If any process has root access, it can mess with any other process

  2. This all depends on the niceness value of the process in question since if more overall CPU time is granted to a process with a lesser nice value, and hence can potentially slow down any other process with a higher nice value if the system is being pushed to the limit

  3. nice allows you to set the 'niceness' of a process, the lower the niceness, the more the priority. As for network you can use trickle to shape the bandwidth

In any case running anything mission critical on a system that's also used for research/dev work is not very optimal and should be avoided whenever it's possible

Amith KK
  • 13,412