zsh-workers
 help / color / mirror / code / Atom feed
* Pid or not pid
@ 1995-11-16 15:57 Peter William Stephenson
  1995-11-16 18:25 ` Richard Coleman
  1995-11-16 23:57 ` Richard Coleman
  0 siblings, 2 replies; 4+ messages in thread
From: Peter William Stephenson @ 1995-11-16 15:57 UTC (permalink / raw)
  To: Zsh hackers list

Some of the code in execcmd() is getting executed in the parent rather
than the child, presumably since the last rearrangement... in
particular, nice(5) is getting called if fork() returned a non-zero
pid, i.e. in the parent (line 1350 of exec.c).  This means each time a
background process is forked, the parent shell has a lower priority.
This may be a good way to deal with process hogs, but I don't think
it's what's intended.

% ps -l -p$$
 F S   UID   PID  PPID  C PRI NI  P    SZ:RSS      WCHAN TTY      TIME COMD
30 S  2082 18544 21831  2  39 20  *   775:366   801bf9c0 pts/54   0:01 zsh
% sleep 3 &
[1] 19247
+4:52% ps -l -p$$
 F S   UID   PID  PPID  C PRI NI  P    SZ:RSS      WCHAN TTY      TIME COMD
30 S  2082 18544 21831  1  39 25  *   775:361   801bf9c0 pts/54   0:01 zsh
% 

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pid or not pid
  1995-11-16 15:57 Pid or not pid Peter William Stephenson
@ 1995-11-16 18:25 ` Richard Coleman
  1995-11-16 21:35   ` Zefram
  1995-11-16 23:57 ` Richard Coleman
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Coleman @ 1995-11-16 18:25 UTC (permalink / raw)
  To: zsh-workers

> Some of the code in execcmd() is getting executed in the parent rather
> than the child, presumably since the last rearrangement... in
> particular, nice(5) is getting called if fork() returned a non-zero
> pid, i.e. in the parent (line 1350 of exec.c).  This means each time a
> background process is forked, the parent shell has a lower priority.
> This may be a good way to deal with process hogs, but I don't think
> it's what's intended.

err...  No I didn't intend that.  But maybe we should leave it
as an option :-)

rc


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pid or not pid
  1995-11-16 18:25 ` Richard Coleman
@ 1995-11-16 21:35   ` Zefram
  0 siblings, 0 replies; 4+ messages in thread
From: Zefram @ 1995-11-16 21:35 UTC (permalink / raw)
  To: Richard Coleman; +Cc: zsh-workers

>> Some of the code in execcmd() is getting executed in the parent rather
>> than the child, presumably since the last rearrangement... in
>> particular, nice(5) is getting called if fork() returned a non-zero
>> pid, i.e. in the parent (line 1350 of exec.c).  This means each time a
>> background process is forked, the parent shell has a lower priority.
>> This may be a good way to deal with process hogs, but I don't think
>> it's what's intended.
>
>err...  No I didn't intend that.  But maybe we should leave it
>as an option :-)

One has to wonder, though, whether this FG_NICE option should be on by
default.  Obviously, the maximally backward compatible choice would be
for it to be on.  (-:

-zefram


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Pid or not pid
  1995-11-16 15:57 Pid or not pid Peter William Stephenson
  1995-11-16 18:25 ` Richard Coleman
@ 1995-11-16 23:57 ` Richard Coleman
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Coleman @ 1995-11-16 23:57 UTC (permalink / raw)
  To: zsh-workers

> Some of the code in execcmd() is getting executed in the parent rather
> than the child, presumably since the last rearrangement... in
> particular, nice(5) is getting called if fork() returned a non-zero
> pid, i.e. in the parent (line 1350 of exec.c).  This means each time a
> background process is forked, the parent shell has a lower priority.
> This may be a good way to deal with process hogs, but I don't think
> it's what's intended.

This is for beta12-test2.  This bug is not present in beta10 or beta11.

rc


*** exec.c	1995/11/16 03:31:23	1.89
--- exec.c	1995/11/16 22:05:14
***************
*** 1345,1353 ****
  	    read(synch[0], &dummy, 1);
  	    close(synch[0]);
  	    if (how & Z_ASYNC) {
- 		/* Check if we should run this job at a lower priority */
- 		if (isset(BGNICE))
- 		    nice(5);
  		lastpid = pid;
  	    } else if (!jobtab[thisjob].stty_in_env && nonempty(cmd->vars)) {
  		/* search for STTY=... */
--- 1345,1350 ----
***************
*** 1367,1372 ****
--- 1364,1373 ----
  	forked = 1;
  	if (sigtrapped[SIGINT] == 2)
  	    holdintr();
+ 	/* Check if we should run background jobs at a lower priority. */
+ 	if ((how & Z_ASYNC) && isset(BGNICE))
+ 	    nice(5);
+ 
      } else if (is_cursh) {
  	/* This is a current shell procedure that didn't need to fork.    *
  	 * This includes current shell procedures that are being exec'ed, *



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1995-11-17  0:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-11-16 15:57 Pid or not pid Peter William Stephenson
1995-11-16 18:25 ` Richard Coleman
1995-11-16 21:35   ` Zefram
1995-11-16 23:57 ` Richard Coleman

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).