0

Is there any kind of a program or a script that I can manually queue processes of applications on Ubuntu? For example there are 40 processes running at a specific point of time and 10 more are about to run in some time after.Is there anyway I can tell the system to run for example the 3 out of 10 at the same time and after they complete to run the 7 remaining one at a time in a specific order?

und3rd06012
  • 717
  • 1
  • 14
  • 19

1 Answers1

1

You could achieve that result with a job-aware shell (zsh,bash).

For instance in bash:

# run first 3 apps in background and in parallel
app1 &
app2 &
app3 &
# wait for all background jobs to finish
wait
# run the remaining apps in specified order
app4
app5
...

The & means run the program in the background (i.e. you get another shell prompt the moment the program is started). All backgrounded jobs run in parallel. However, backgrounded jobs cannot access the standard input (i.e. you can't provide keyboard input to them - well, you can, by bringing to the foreground first, but that's another story).

isedev
  • 18,848
  • 3
  • 60
  • 59
  • Thanks isedev. Is it possible for this shell to be aware to do this queueing depending on the user that the process has come from? For example if there are 3 people using the pc at the same time and I want user1 and user2 to not wait at all in the queue but I want user3 to execute serially or even stall his processes? Also is it possible to make it automated (like make it doing this queueing without doing it myself manually)? – und3rd06012 Oct 02 '14 at 19:35
  • That's a very broad question, it depends on many things - first that comes to mind is "how are the jobs submitted". The shell provides programming features (flow control, variables, etc...) so you might be able to implement what you need. – isedev Oct 02 '14 at 19:38
  • Is it possible for you to point me a book or a online source in which I can these programming features of the shell? – und3rd06012 Oct 02 '14 at 19:54
  • Well, the manual page (e.g. `man bash`) provides a good reference. This [HOWTO](http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html) might be a good intro. Otherwise, google `bash programming` or `zsh programming`. There should be plenty of stuff out there. – isedev Oct 02 '14 at 19:56
  • Thank you for your valuable help isedev.Have a nice day! – und3rd06012 Oct 02 '14 at 19:58