zsh-workers
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi <hzoli@cs.elte.hu>
To: schaefer@nbn.com
Cc: zsh-workers@math.gatech.edu
Subject: Re: Blocking child signals
Date: Fri, 19 Jul 1996 03:08:33 +0200 (MET DST)	[thread overview]
Message-ID: <199607190108.DAA02567@hzoli.ppp.cs.elte.hu> (raw)
In-Reply-To: <960714230242.ZM2685@candle.brasslantern.com> from Bart Schaefer at "Jul 14, 96 11:02:38 pm"

> It's possible you'd get a little performance, but I don't think it's
> worth the effort.  Signal blocking/unblocking shouldn't be a very time-
> consuming operation, except maybe for the old-style SYSV_SIGNALS or no-
> signal-blocking cases.

I remember that when signals were blocked instead of queued in mem.c and a
blocking/unblocking happened with each zalloc() zsh become more that 2 times
slower.  Of course zalloc() is called very often and in our case a similar
change may not have any noticable effect on the speed.

> I'd be willing to bet that the vast majority of those block/unblock pairs
> are happening in waitjob() and relatives, where zsh is in a loop doing

That's not the case when a cript use mostly builtins.

> It's important to block SIGCHLD signals not just before forking, but at
> any time you're going to manipulate the job table if any child is still
> executing.  You could add code to examine the job table and avoid making
> the system call when no children exist, but my guess is that would be
> just as expensive as simply making the call.

I was thinking about queueing the child signals somehow.  I started to
write something like that but in the end I gave up.  Also I'm not fully
convinced that the present code rules out all cases when the job table may
be changed unexpectedly by an unblocked child signal.

> The child blocking stuff corrected a whole bunch of zsh bugs, including
> (if I recall correctly) one where pipelines like "/bin/echo foo | less",
> where the first command exits very quickly, confused zsh into thinking
> the entire pipeline had exited, thus leaving "less" an orphan.

Yes, around a fork() blocking seems to be necessary.

Zoltan



  reply	other threads:[~1996-07-19  1:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-15  2:43 Zoltan Hidvegi
1996-07-15  6:02 ` Bart Schaefer
1996-07-19  1:08   ` Zoltan Hidvegi [this message]
1996-07-15  6:37 Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199607190108.DAA02567@hzoli.ppp.cs.elte.hu \
    --to=hzoli@cs.elte.hu \
    --cc=schaefer@nbn.com \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).