help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Fwd: The best way to monitor the number of concurrently runn


From: Peng Yu
Subject: [Help-bash] Fwd: The best way to monitor the number of concurrently running processes forked by a main bash script ?
Date: Tue, 2 Apr 2019 07:22:06 -0500

---------- Forwarded message ----------
From: Peng Yu <address@hidden>
Date: Tue, 2 Apr 2019 07:21:36 -0500
> ps will show you *all* the concurrently running processes that meet the
> selection criteria -- it gets the info straight from the kernel.

If the system is heavily loaded and it takes a long time to finish
running ps, will the earliest processes finished when `ps` finishes
(in such case, ps does not so *concurrently" running processes)?

> And "watch" will run "ps" every 2 seconds (or as often as you configure it
> to, watch can take an argument).  If getting a snapshot every 2 seconds is
> not good enough, can you modify the child processes themselves to log when
> they start and exit? Would that accomplish your purpose better?

It is not always possible. For example, the following thing will
result in one processes.

<(one_external_command)

But this will result in two processes.

<(some_log_code; one_external_command)

Also, it is practically infeasible to modify a lot of code to profile
the number of processes used. I think that this is better to be done
at the bash language level.

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]