bug-make
[Top][All Lists]
Advanced

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

[bug #51200] Improvement suggestion: listen to signals to adjust number


From: Henrik Carlqvist
Subject: [bug #51200] Improvement suggestion: listen to signals to adjust number of jobs
Date: Mon, 20 Mar 2023 13:58:21 -0400 (EDT)

Follow-up Comment #3, bug #51200 (project make):

My latest patch signal_num_jobs6.patch is almost a complete rewrite to work
better with recursive calls to make. Jobs are simply added by putting tokens
in the pipe from the signal routine for SIGUSR2. Revoking jobs are slightly
more tricky, a separate process is spawned with fork which tries to remove a
token from the pipe. However, some jobs might be able to start before the
process is able to revoke a token. Making that process busy waiting on the
pipe much increases the probability that it will become the first process to
get a token, but I didn't want to do that. Another option might have been to
make the ordinary make processes sleep some ms each time before they pick a
token, but I didn't want to do that either. My choice was to live with the
fact that it might take a long time before the number of jobs are decreased.

An slightly intrusive change from this patch is that the job server is always
setup initially. This is as it cannot be done in a signal safe way from the
signal handlers, it has to be ready when the signal handlers need them. This
also means that the job server is setup when -j is called without a value.
That was supposed to give an infinite number of jobs, but the job server has
to have a limit. My choice for now was to set that limit to 10000 jobs. In
practice 10000 jobs are enough to be backwards compatible with the old
behavior of make to by default become kind of a fork bomb on a big source tree
to build when no value is given to -j. By definition 10000 jobs are not an
infinite number of jobs, but in practice I see no big difference. Maybe I
would prefer to by default limit the number of jobs to a low number and let
the people who really know what they are doing specify higher numbers if they
want to, but that would break backwards compatibility.

(file #54516)

    _______________________________________________________

Additional Item Attachment:

File name: signal_num_jobs6.patch         Size:5 KB
    <https://file.savannah.gnu.org/file/signal_num_jobs6.patch?file_id=54516>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?51200>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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