The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: ramble1035@dslextreme.com (ramble1035 @dslextreme.com)
Subject: [TUHS] "Slow system call" and EINTR
Date: Thu, 1 Mar 2012 15:59:53 -0800	[thread overview]
Message-ID: <CAFn3HkPJ7ccGZXrupAeFo5nK6Xab_Denuu2qW4qAwenixHdCrQ@mail.gmail.com> (raw)
In-Reply-To: <CAGGBd_p12gWvRTz5soB_swFkT4QxL0upTKxLP2L_P=UKym2Z6w@mail.gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1531 bytes --]

On Thu, Mar 1, 2012 at 3:29 PM, Dan Stromberg <drsalists at gmail.com> wrote:
>
> I gather system calls can return EINTR only when they are "slow".  True?

For a unique definition of "slow"...  :)

> What makes a system call "slow"?  Is it the ability to block for a while?
> But I wouldn't think dup(2) would block, for example.

From my experience, a slow vs fast call is only partially based on
time.  It's more based on obtaining and releasing resources.

A slow system call is one that might take a long time, and any
resource allocations requested during the system call processing can
be easily undone (returned).  TTY input, as an example.

Things like a disk request are *supposed* to be quick, but even if
they're not, they involve allocating buffers, queueing disk requests,
setting up possible interrupts or DMA, and other messy internal
details.  Aborting a pending disk request would be a substantial
amount of effort.  Thus, a disk request cannot be interrupted and it's
classified as "fast".  (or "not slow")

This presents a few difficulties when you consider something like NFS,
which acts like a disk request until it gets down to the network
layer, where things might well take a long time.  But interrupting and
aborting this is not easy, which is why some NFS requests, when hung,
stay hung even when you bang on Control-C for a while.

Really simple things like dup, which involves a simple copy, would
probably not block unless there were extreme issues with memory
allocation or something.

  -- Chris



      reply	other threads:[~2012-03-01 23:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-01 23:29 Dan Stromberg
2012-03-01 23:59 ` ramble1035 @dslextreme.com [this message]

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=CAFn3HkPJ7ccGZXrupAeFo5nK6Xab_Denuu2qW4qAwenixHdCrQ@mail.gmail.com \
    --to=ramble1035@dslextreme.com \
    /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.
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).