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

2023-03-20 Thread Henrik Carlqvist
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 1 jobs. In
practice 1 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 1 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




___

Reply to this item at:

  

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




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

2023-03-20 Thread Henrik Carlqvist
Additional Item Attachment, bug #51200 (project make):

File name: signal_num_jobs6.patch Size:5 KB




___

Reply to this item at:

  

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




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

2020-07-04 Thread Henrik Carlqvist
Additional Item Attachment, bug #51200 (project make):

File name: signal_num_jobs5.patch Size:3 KB




___

Reply to this item at:

  

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




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

2017-11-19 Thread Henrik Carlqvist
Follow-up Comment #1, bug #51200 (project make):

As the directory structure recently changed in git, would you like me to send
an updated patch?

regards Henrik

___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


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

2017-06-07 Thread anonymous
URL:
  

 Summary: Improvement suggestion: listen to signals to adjust
number of jobs
 Project: make
Submitted by: None
Submitted on: Wed 07 Jun 2017 06:43:43 PM UTC
Severity: 3 - Normal
  Item Group: Enhancement
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
 Discussion Lock: Any
   Component Version: SCM
Operating System: POSIX-Based
   Fixed Release: None
   Triage Status: None

___

Details:

Many times after starting make I have wished that I started it with more
parallel jobs than I did. A few time I have also wished that I started make
with fewer parallel jobs.

The attached patch allows you to send SIGUSR2 to your top level make process
to add one more parallel job.

Once a SIGUSR2 is received the functionality of SIGUSR1 also changes from
toggling debug output to decrease the number of jobs by 1. No running job will
be killed, but when the next target is finished one less job will be started
again.

If make was started with parallel jobs SIGUSR2 will immediately increase the
number of jobs with one. If make was started without -j SIGUSR2 will not cause
make to work in parallel until the current target is finished.

The patch was written against sources from git, but also works with latest
stable version 4.2.1.

I hope that you will find my patch useful and that it somehow will make it
into upcoming stable releases of make.

Please feel free to discuss improvements of the patch, I have subscribed to
the bug-make mailing list.



___

File Attachments:


---
Date: Wed 07 Jun 2017 06:43:43 PM UTC  Name: signal_num_jobs3.patch  Size: 3kB
  By: None



___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make