# Base.addprocs() affects other software

**URL:** https://discourse.julialang.org/t/base-addprocs-affects-other-software/8923
**Category:** Internals & Design
**Tags:** question, multithreading, linux
**Created:** [February 8, 2018, 12:49pm UTC](https://discourse.julialang.org/t/base-addprocs-affects-other-software/8923 "2018-02-08T12:49:26Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mvhulten](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mvhulten/32/2444_2.png) [@mvhulten](https://discourse.julialang.org/u/mvhulten)
#### Post date: [February 8, 2018, 12:49pm UTC](https://discourse.julialang.org/t/base-addprocs-affects-other-software/8923/1 "2018-02-08T12:49:26Z")

</div>

I tried this _don’t do this at home (well, maybe you should try this at home instead of at some place where others would not appreciate this)_ command on my laptop with 4 processors:

```
addprocs(80)

```

This affected several things on my system.

- Computer became slow (maybe expected);
- Firefox crashed (not expected);
- login prompts on vc’s started crashing (not expected).

After failed attempts to login on a virtual console (vc) I could switch back to X and do a `killall julia` in a running xterm, restart my web browser and everything was fine again. I guess what Julia is doing, launching processes you asked for, is fine! I guess that the unexpected things are due to issues with other software. Firefox crashing seems like a bug in Firefox: if resources get exhausted by some other program, this should still not happen. The login prompts on my vc’s should also be more stable, I think.

Do others agree? Should these issues be reported at Mozilla and other places?

What if I tried this on the login node of a supercomputer instead of on my workstation/laptop? (That one is rethorical — I could possibly cause similar problems, and many people would not be happy.)

Should I expect similar behaviour on the BSDs? I guess in GNU/Linux that by setting limits (e.g. with `ulimit` or SELinux et al.) this issue can be mitigated.

I am using an Ubuntu 16.04 system running with Linux 4.13.0, systemd-logind, Julia 0.6.2, Firefox 58.0.1 and other software.

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [February 8, 2018, 2:46pm UTC](https://discourse.julialang.org/t/base-addprocs-affects-other-software/8923/2 "2018-02-08T14:46:46Z")

</div>

> [@mvhulten](#):
>
> After failed attempts to login on a virtual console (vc) I could switch back to X and do a killall julia in a running xterm, restart my web browser and everything was fine again. I guess what Julia is doing, launching processes you asked for, is fine! I guess that the unexpected things are due to issues with other software. Firefox crashing seems like a bug in Firefox: if resources get exhausted by some other program, this should still not happen. The login prompts on my vc’s should also be more stable, I think.

This kind of crashing happens on every OS with pretty much every software if you vastly overutilize your resources. I think the answer is, just don’t do it.

> [@mvhulten](#):
>
> What if I tried this on the login node of a supercomputer instead of on my workstation/laptop? (That one is rethorical — I could possibly cause similar problems, and many people would not be happy.)

Login nodes specifically tell you to not do this. Never ever should a parallel command be ran on a login node. In fact, this is how login nodes go down… and that happens quite often…

---

<div class="post-metadata">

### Author: ![pasha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pasha/32/3319_2.png) [@pasha](https://discourse.julialang.org/u/pasha)
#### Post date: [February 8, 2018, 3:09pm UTC](https://discourse.julialang.org/t/base-addprocs-affects-other-software/8923/3 "2018-02-08T15:09:57Z")

</div>

This isn’t a bug, it’s a feature. I’d rather not be protected from this kind of thing. We should be glad to have software that is low-level enough to take down a system. I’ve run into similar problems by using up all memory.

If you want to prevent your program from causing this, you can do something like `@assert nmappers < 2 * Sys.CPU_CORES` where `nmappers` might be running `addprocs()` later. There’s no useful way to keep users from typing stuff into the REPL though.

---

<div class="post-metadata">

### Author: ![mvhulten](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mvhulten/32/2444_2.png) [@mvhulten](https://discourse.julialang.org/u/mvhulten)
#### Post date: [February 8, 2018, 7:25pm UTC](https://discourse.julialang.org/t/base-addprocs-affects-other-software/8923/4 "2018-02-08T19:25:29Z")

</div>

Fair enough. Thank you both for the tips

---

<div class="post-metadata">

### Author: ![John\_Hearns](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/john_hearns/32/1685_2.png) [@John\_Hearns](https://discourse.julialang.org/u/John_Hearns)
#### Post date: [February 9, 2018, 11:54am UTC](https://discourse.julialang.org/t/base-addprocs-affects-other-software/8923/5 "2018-02-09T11:54:29Z")

</div>

Good questions here.  
Regarding HPC setups, on the HPC which I manage we have implemented cgroups for jobs. SO your job is constrained on the CPU cores and memory it can access. Also for GPU nodes you are given access to only one (or more) GPUs.  
The login nodes do not at the moment have cgroups for users but we will be moving towards that.

---

<div class="post-metadata">

### Author: ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)
#### Post date: [February 9, 2018, 2:41pm UTC](https://discourse.julialang.org/t/base-addprocs-affects-other-software/8923/6 "2018-02-09T14:41:37Z")

</div>

> [@ChrisRackauckas](#):
>
> This kind of crashing happens on every OS with pretty much every software if you vastly overutilize your resources. I think the answer is, just don’t do it.

This raises the question of what resources a Julia instance requires. I see about 100 MiB of unshared memory per process, which seems bloated. (So OOM is not surprising for 80 procs on a typical laptop with other stuff running.)
