<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Nachricht</TITLE>
<META content="MSHTML 6.00.6000.16640" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=551591719-29042008><FONT face=Arial color=#0000ff size=2>I
don't know if this would be worth, but theoretically one could go on and
evaluate those thunks that:</FONT></SPAN></DIV>
<DIV><SPAN class=551591719-29042008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=551591719-29042008><FONT face=Arial color=#0000ff size=2>a)
would be evaluated anyway (after the current IO operation have been
completed)</FONT></SPAN></DIV>
<DIV><SPAN class=551591719-29042008><FONT face=Arial color=#0000ff size=2>b) do
not depend on the result of the current operation</FONT></SPAN></DIV>
<DIV><SPAN class=551591719-29042008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=551591719-29042008><FONT face=Arial color=#0000ff size=2>And,
of course, the GC could work in this time also.</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV align=left><FONT face=Arial size=2>Nicu</FONT></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=de dir=ltr align=left><FONT face=Tahoma
size=2>-----Ursprüngliche Nachricht-----<BR><B>Von:</B>
haskell-cafe-bounces@haskell.org [mailto:haskell-cafe-bounces@haskell.org]
<B>Im Auftrag von </B>Brent Yorgey<BR><B>Gesendet:</B> Dienstag, 29. April
2008 16:42<BR><B>An:</B> Daniil Elovkov<BR><B>Cc:</B>
haskell-cafe@haskell.org<BR><B>Betreff:</B> Re: [Haskell-cafe] Something like
optimistic evaluation<BR><BR></FONT></DIV><BR>
<DIV class=gmail_quote>On Mon, Apr 28, 2008 at 6:09 PM, Daniil Elovkov <<A
href="mailto:daniil.elovkov@googlemail.com">daniil.elovkov@googlemail.com</A>>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Hello<BR><BR>Somewhat
on the topic of optimistic evaluation, I've just thought of another way to
evaluate thunks.<BR><BR>When the program is about to block on some IO, what
if we start a thread to evaluate (any) unevaluated thunks. We'll have
additional system thread, but the blocked one will not actually consume any
processor time.<BR><BR>This would take place only when the program is
compiled as threaded and run with -N k, k>1.<BR><BR>The RTS knows at
least about some operations that will block, those which IO operations are
implemented with. for example. It could merely start a process of evaluating
any (or something more clever) outstanding thunks right before going into
one of those operations and stop it when it's back.<BR><BR>Of course, it's
not like optimistic evaluation because we don't avoid creating thunks. But
in a sense it's similar. It could also be compared with incremental garbage
collection :)<BR><BR>Has something like that been done,
discussed?<BR></BLOCKQUOTE>
<DIV><BR>This sounds like it could be helpful in certain circumstances, but in
many cases it could probably lead to unpredictable (and uncontrollable!)
memory usage. I could imagine a situation where my program is running
along just fine, and then one day it takes a long time to do a read from the
network due to latency or whatever, and suddenly memory usage shoots through
the roof, due to evaluation of some infinite (or even just very large) data
structure. <BR><BR>-Brent<BR></DIV></DIV></BLOCKQUOTE></BODY></HTML>