unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Antoine Levitt <antoine.levitt@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: lennart.borgman@gmail.com, joakim@verona.se, emacs-devel@gnu.org
Subject: Re: Emacs inotify support?
Date: Sat, 12 Sep 2009 22:04:49 +0200	[thread overview]
Message-ID: <6fa54e4e0909121304u1ddc5b78tc7c9e1f5c756aabf@mail.gmail.com> (raw)
In-Reply-To: <83my50ymj5.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2556 bytes --]

I'm afraid I got confused. It seems the confusion stems from the use of the
term poll. I was referring to the use described in
http://en.wikipedia.org/wiki/Polling_%28computer_science%29 , ie something
like : check the status of the files by looking at their timestamps, wait a
fixed timeout, and check again (which is terrible, I hope you agree). "poll"
and "select" system calls look like what the wiki page calls
interrupt-driven IO (which does have the qualities I described in my
previous post).

I was not aware of these (shame on me). They mean inotify has no relevance
to the action of watching for changes in a file, where poll and select do
the trick perfectly well.
2009/9/12 Eli Zaretskii <eliz@gnu.org>

> > Date: Sat, 12 Sep 2009 19:26:14 +0200
> > From: Antoine Levitt <antoine.levitt@gmail.com>
> > Cc: lennart.borgman@gmail.com, joakim@verona.se, emacs-devel@gnu.org
> >
> > > > Date: Sat, 12 Sep 2009 18:36:47 +0200
> > > > From: Antoine Levitt <antoine.levitt@gmail.com>
> > > > Cc: lennart.borgman@gmail.com, joakim@verona.se, emacs-devel@gnu.org
> > > >
> > > > If possible, polling should be avoided, though.
> > >
> > > Why?
> >
> > Well, I don't know much about file systems, but isn't it always better
> > to be notified than to poll ?
>
> But (AFAIU) inotify works by giving the application a file descriptor
> that the application needs to pass to `select' or `poll' in order to
> get notifications.  This is exactly the kind of ``polling'' Emacs does
> with any external event (except for signals).
>
> So we are up for polling anyway.
>
> > First, having a notification system
> > means it's instantaneous. Second, I'd imagine querying the state of a
> > file has a cost (especially if it can't be cached and needs a real
> > access to the hard drive). Third, it'd avoid a waste of CPU resources
> > (which may be important for power consumption, since, from what I
> > understood, the more a program has fixed timers, the more it wakes the
> > CPU from sleep). Fourth, being notified is more high-level, since the
> > notification itself can be implemented by polling. One could imagine a
> > notification API where the backend would use inotify if available,
> > polling if not.
>
> You seem to be thinking of some signal-like mechanism.  But that's not
> how these notifications work (nor do I think it's a good idea for them
> to work like that in Emacs, where interrupting code at an arbitrary
> moment is not a good idea).
>
> As for wasting CPU time, system calls like `select' and `poll' don't
> waste them too much.
>

[-- Attachment #2: Type: text/html, Size: 3602 bytes --]

  reply	other threads:[~2009-09-12 20:04 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-11 20:34 Emacs inotify support? joakim
2009-09-11 21:28 ` Lennart Borgman
2009-09-11 22:54   ` Antoine Levitt
2009-09-11 23:00     ` Lennart Borgman
2009-09-12 13:32     ` Eli Zaretskii
2009-09-12 16:36       ` Antoine Levitt
2009-09-12 16:55         ` Eli Zaretskii
2009-09-12 17:26           ` Antoine Levitt
2009-09-12 19:45             ` Eli Zaretskii
2009-09-12 20:04               ` Antoine Levitt [this message]
2009-09-12 21:24               ` Giuseppe Scrivano
2009-09-13 16:39       ` Richard Stallman
2009-09-13 17:28         ` joakim
2009-09-13 19:42           ` Eli Zaretskii
2009-09-13 22:28             ` Lennart Borgman
2009-09-14  5:47             ` joakim
2009-09-14 18:08               ` Eli Zaretskii
2009-09-12 16:46     ` Richard Stallman
2009-09-13  2:27       ` Miles Bader
2009-09-13  9:33         ` David Kastrup
2009-09-12 16:46 ` Richard Stallman
2009-09-14  7:39   ` Paul R
2009-09-15  7:17     ` Richard Stallman
2009-09-17 15:12       ` Juri Linkov
2009-09-18  9:49         ` Richard Stallman
2009-09-18 12:10           ` David Kastrup
2009-09-18 17:14             ` Stefan Monnier
2009-09-18 18:38               ` joakim
2009-09-21 21:45           ` Dired auto-revert (was: Emacs inotify support?) Juri Linkov
2009-09-21 22:29             ` Drew Adams
2009-09-23  9:05               ` Dired auto-revert Juri Linkov
2009-12-04  0:11                 ` Proced revert (Re: Dired auto-revert) Juri Linkov
2009-12-04  2:17                   ` Stefan Monnier
2009-12-04 22:21                   ` Roland Winkler
2009-12-04  0:09               ` Dired auto-revert Juri Linkov
2009-12-04  2:15                 ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=6fa54e4e0909121304u1ddc5b78tc7c9e1f5c756aabf@mail.gmail.com \
    --to=antoine.levitt@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=joakim@verona.se \
    --cc=lennart.borgman@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).