[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] On Hurd, don't use not implemented madvise()

From: Mark H Weaver
Subject: Re: [PATCH] On Hurd, don't use not implemented madvise()
Date: Fri, 02 Jun 2017 22:00:18 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

<address@hidden> writes:

> On Thu, Jun 01, 2017 at 07:29:03PM -0400, Mark H Weaver wrote:
>> Manolis Ragkousis <address@hidden> writes:
> [...]
>> > Also from my understanding not using madvise() ends up in slower
>> > performance but it doesn't create problems to the program, right?
>> Some programs for Guile 2.2 may take advantage of the dynamically
>> expandable stacks, because it allows programs to written in a more
>> natural way.  Such programs may in some cases temporarily allocate a lot
>> of stack space.  If this memory can never be reclaimed on Hurd, that may
>> cause problems for some programs.
> This would at least suggest having a way to query whether madvise is
> available, through some introspection (giving the program a chance
> to adapt its behavior)?

First of all, you should read this for background:

If you've done that, then you should understand that this new feature in
guile-2.2 fundamentally changes the way we can express loops in Scheme
that build recursive data structures where scalability is important.

For example, 'map' can now be written like this:

  (define (map f l)
    (if (pair? l)
        (cons (f (car l))
              (map f (cdr l)))

whereas we used to have to write code like this in order to support long
lists without overflowing the stack:

  (define (map f l)
    (let loop ((l l) (out '()))
      (if (pair? l)
          (loop (cdr l) (cons (f (car l)) out))
          (reverse out))))

Consider how frequently patterns like this occur.  Do you really want to
duplicate every piece of code with a loop of this form?  It would be
better to just give up on this new feature entirely.

Anyway, even if you did duplicate your code, that would not solve the
problem, because many procedures in Guile itself are now written in the
nicer way to take advantage of this.  One such example is 'map'.

I'm quite fond of the Hurd design, and I hope it continues to grow, but
it's unrealistic to expect developers to write loops like this in a
fundamentally less clear way to cater to an experimental OS that has so
few users.

Does that make sense?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]