Stories
Slash Boxes
Comments

SoylentNews is people

The Fine print: The following are owned by whoever posted them. We are not responsible for them in any way.

Journal by cafebabe

A problematic bug in simple-init can be resolved by eliminating one variable. Specifically, change:-

$wait=60*60*24;
while($active&& $running) {
  (undef,$wait)=select(undef,undef,undef,$wait);
}

to:-

while($active&& $running) {
  select(undef,undef,undef,60*60*24);
}

or suchlike. This change eliminates the case where the variable is zero and a busy wait on select() ensues.

Minor bugs remain. Regardless, simple-init is now suitable for deployment on systems which do not require suspend.

Display Options Threshold/Breakthrough Reply to Comment Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 2) by cafebabe on Friday August 19 2016, @12:15AM

    by cafebabe (894) on Friday August 19 2016, @12:15AM (#389801) Journal

    For downward compatibility, the code was intended to run on Perl4. For really obscure reasons, I hoped that any surplus energy consumption on a dormant system would occur at the same time every day (or drift so slowly that observed output was functionally similar). Unfortunately, this led to a lapse where I didn't consider the granularity of select() or the case where the input was zero. This case most typically occurs when a system is under load. Even then, it typically consumes 1/n of the processing power (or one core of processing power when there is no load). This is annoying inefficient and now resolved.

    It is preferable to keep dependencies down - especially in an init system. As a further example of keeping dependencies down, the LAMP application being developed in my venture has a 2KB shim of Perl4 which locates a Perl4 library loader. This works even if the application is invoked via multiple nested symbolic links. This may seem like a major overkill but it ensures that the application works consistently on crufty systems and also where there is no root access on a system. This reduces the bloat and technical debt where it is now typical to use a container. Although container creation is fast and covers many cases, the downside is that each container is subsequently dependent on security fixes.

    --
    1702845791×2
    Starting Score:    1  point
    Karma-Bonus Modifier   +1  

    Total Score:   2  
  • (Score: 2) by Knowledge Troll on Friday August 19 2016, @01:45AM

    by Knowledge Troll (5948) on Friday August 19 2016, @01:45AM (#389832) Homepage Journal

    For downward compatibility, the code was intended to run on Perl4.

    Whoa uhm ok.

    It is preferable to keep dependencies down - especially in an init system.

    Time::HiRes is in Core so it is already everywhere perl 5 is. Perl 4 I dunno. It even looks like strict depends on Time::HiRes so I would assume it has already even been loaded. But then Perl 4. *shrug*

    And you should still find an algorithm for sleeping and ensuring the right sleep duration happened then either faulting or gracefully recovering from it.

    • (Score: 2) by cafebabe on Friday August 19 2016, @11:02AM

      by cafebabe (894) on Friday August 19 2016, @11:02AM (#390025) Journal

      To get stuff to run on Perl4, Perl5 and Perl6, avoid array slices, :: and /e regular expressions with anything apart from data which is seven bit clean.

      The underlying implementation of select() is more problematic. Different kernels may or may not set struct timeval to different levels of granularity. For my purposes, this was nice-to-have but providing a constant with each invocation is sufficient. In the general case, it may be necessary to check elapsed time with a separate system call. This may lead to further erroneous assumptions about time [infiniteundo.com].

      --
      1702845791×2