home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / scheme / 2771 < prev    next >
Encoding:
Internet Message Format  |  1992-12-16  |  2.0 KB

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!cs.utexas.edu!sun-barr!olivea!spool.mu.edu!sgiblab!cs.uoregon.edu!nntpserver!mike
  2. From: mike@mystix.cs.uoregon.edu (Michael John Haertel)
  3. Newsgroups: comp.lang.scheme
  4. Subject: Using memory mapping to implement continuations
  5. Message-ID: <MIKE.92Dec16130919@mystix.cs.uoregon.edu>
  6. Date: 16 Dec 92 21:09:19 GMT
  7. References: <4051@mitech.com> <FEELEY.92Dec14215701@zohar.ai.mit.edu>
  8.     <4067@mitech.com><1992Dec15.201735.21731@netcom.com>
  9.     <GJR.92Dec15214517@klosters.ai.mit.edu>
  10.     <1992Dec16.190713.20460@netcom.com>
  11. Sender: news@cs.uoregon.edu (Netnews Owner)
  12. Organization: CS Dept, University of Oregon
  13. Lines: 23
  14. In-Reply-To: thinman@netcom.com's message of 16 Dec 92 19:07:13 GMT
  15.  
  16. A number of articles in the "Are interpreters as fast... " thread
  17. refer to using page-remapping to implement continuations.
  18.  
  19. I don't see this as a big benefit.  If continuations are implemented
  20. by stack copying, they're too expensive to use for anything in an
  21. inner loop (like all those cool backtracking algorithms that use
  22. continuations).  If continuations are implemented by making memory
  23. mapping system calls (read: trapping to the OS, saving lots of
  24. registers, going through a hairy VM system locking protocol, frobbing
  25. the MMU, trashing the cache, unlocking the VM system, restoring lots
  26. of registers, and returning to user mode) they're STILL too expensive
  27. to use.  In fact, some machines might be able to copy a page or two of
  28. stack faster than they can make the necessary system calls.  (Note that
  29. copy-on-write for large things like fork() is still a win, because it
  30. amortizes the system call overhead, but continuations probably involve
  31. at most a page or two of data on average.)
  32.  
  33. The only implementation I've ever seen where continuations were cheap
  34. enough that I'd actually want to use them is SML of NJ.  But in that
  35. implementation it's achieved perhaps at the cost of making procedure
  36. calls a little more expensive than they should be.
  37.  
  38. Memory remapping is not free.
  39.