[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Power: blink-cursor-mode is a pig
From: |
Daniel Colascione |
Subject: |
Re: Power: blink-cursor-mode is a pig |
Date: |
Fri, 30 Dec 2011 04:39:42 -0800 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
On 12/30/11 3:58 AM, Daniel Colascione wrote:
>> Here's what confuses me. Timers are implemented as part of the Emacs
>> internal loop that watches the various channels (keyboard, subprocess
>> pipes, network connections) for available input. The loop that does
>> this is always running; it never stops, except for very short periods
>> of time.
>
> The Emacs main loop does not busy wait! When Emacs is not busy
> running lisp or doing other work, it waits blocked in select(2) until
> input arrives, a signal arrives, or the timeout given to select
> expires. Emacs chooses the timeout by looking at all its pending
> timers and seeing which one will expire soonest. If the next timer
> isn't due for an hour, Emacs will sleep for an hour before returning
> from select. During this time, Emacs will use no power because it
> won't actually run --- the operating system maintains its own timer
> queue and wakes threads only when they need to run.
I should add that the machine as a whole does something very similar
to what Emacs does with its select timeout: the OS's thread scheduler
looks at what timers are scheduled across the entire system and puts
the CPU into a low-power state until the next one is due to expire.
That's why it's important for programs not to wake themselves up
unnecessarily: even one badly-behaved program can force the entire
system out of this low-power state. When Emacs wakes up every 500ms
to uselessly blink an invisible cursor, it's just being rude, like
that kid we all knew in college who interrupted the professor every
other sentence.
signature.asc
Description: OpenPGP digital signature
- Power: blink-cursor-mode is a pig, Daniel Colascione, 2011/12/29
- Re: Power: blink-cursor-mode is a pig, Lennart Borgman, 2011/12/29
- Re: Power: blink-cursor-mode is a pig, Eli Zaretskii, 2011/12/30
- Re: Power: blink-cursor-mode is a pig, Lennart Borgman, 2011/12/30
- Re: Power: blink-cursor-mode is a pig, Daniel Colascione, 2011/12/30
- Re: Power: blink-cursor-mode is a pig, 山本 光晴, 2011/12/30
- Re: Power: blink-cursor-mode is a pig, Eli Zaretskii, 2011/12/30
- Re: Power: blink-cursor-mode is a pig, YAMAMOTO Mitsuharu, 2011/12/30
- Re: Power: blink-cursor-mode is a pig, Eli Zaretskii, 2011/12/31
- Re: Power: blink-cursor-mode is a pig, Daniel Colascione, 2011/12/31
- Re: Power: blink-cursor-mode is a pig, YAMAMOTO Mitsuharu, 2011/12/31
- Re: Power: blink-cursor-mode is a pig, Jan Djärv, 2011/12/31
- Re: Power: blink-cursor-mode is a pig, Eli Zaretskii, 2011/12/31
Re: Power: blink-cursor-mode is a pig, David De La Harpe Golden, 2011/12/30