Is there a limit to how many jobs you can have running in the background when using command prompt? I've heard varying answers to this question, but is there a concrete number that is set as the limit?
Asked
Active
Viewed 3,798 times
2 Answers
2
This is defined in each shell's source code for jobs
as the size of the job table and presumably it should keep a general resemblance with the resource limit for maximum number of processes of a user.
In bash
it's 8192, from jobs.c
of bash
source code:
#if !MAX_CHILD_MAX
# define MAX_CHILD_MAX 8192
#endif

heemayl
- 56,300
0
As foreground/background is entirely a shell thing (it might affect which filehandles are passed to a process, but that can be affected in other ways), such a limit would have to come from your shell. I've never heard of a shell setting a limit, and as far as I can tell, it would require more code for no real gain, so I doubt any shell does, but there are lots of shells I haven't tried and (probably) more I haven't even heard of.
-
I'm fairly new to Linux and use the bash shell pretty much 99% of the time. I know foreground processes are limited to one at a time since the process consumes the command line, but as far as you know, bash has no limit on background processes? – nosferatwo Mar 28 '16 at 01:31
-
Bash uses a linked list of a structure so memory might be a limiting factor, if cpu isn't – Jeff Schaller Mar 28 '16 at 01:37
-
Each process consumes a number of file descriptors, which are also finite resources. – Mar 28 '16 at 01:42
-
@JeffSchaller: I hadn't thought of that. that might actually set a limit, but I'm guessing it will be pretty high. – Henrik supports the community Mar 28 '16 at 01:46