Permalink
Browse files

Cosmetic changes

	modified:   docs/IFAQ.txt
	modified:   docs/manual.html
	modified:   docs/style.css
  • Loading branch information...
1 parent 8ee45f7 commit 03dadd5f1fd2ea7705a34f3ddf0db32cd6ba3920 @sriram-srinivasan sriram-srinivasan committed Mar 17, 2010
Showing with 42 additions and 52 deletions.
  1. +16 −23 docs/IFAQ.txt
  2. +2 −3 docs/manual.html
  3. +24 −26 docs/style.css
View
@@ -1,12 +1,10 @@
(Copyright 2007 Sriram Srinivasan)
-Kilim IFAQ: Infrequently Asked Questions. Kilim v 0.5
--- sriram srinivasan (kilim@malhar.net)
-
+Kilim IFAQ: Infrequently Asked Questions. Kilim v 0.7
+-- sriram srinivasan (Kilim _at_ malhar.net)
======================================================================
-Why do people make such a big deal about the how hard it is to do
-thread programming?
+Why is multi-threaded programming considered so hard?
======================================================================
It is relatively easy to get thread programming correct (to a first
approximation) by synchronizing all your shared data structures and
@@ -23,7 +21,7 @@ Kilim uses kernel threads. Where do tasks and threads meet?
======================================================================
Kilim's tasks are cooperatively scheduled and Java threads are
-preemptively scheduled. (I'd prefer kilim's tasks to be preemptable as
+preemptively scheduled. (I'd prefer Kilim's tasks to be preemptible as
well, but cannot do that without changing the JVM). Tasks are needed
when you want to split up your workflow into small stages and write
code as if it is blocking (instead of writing a callback and having to
@@ -33,7 +31,7 @@ not the end of the world. That's what other threads are for .. they'll
take care of the other tasks meanwhile.
A Kilim task is owned and managed by a scheduler, which also manages a
-thread pool. When a task needs to block, it removes itself from the
+thread pool. When a task needs to pause, it removes itself from the
thread by popping its call stack, remembering enough about each
activation frame in order to help rebuild the stack and resume, at a
later point). The scheduler then reuses that thread for some other
@@ -71,19 +69,16 @@ Alef etc. and Kilim's mailboxes?
Most of these languages use synchronous channels as their basic
construct, where a sending task can proceed only after the receiver
-has received (or vice-versa). I have a few issues with these approaches.
-
-1. These systems are easy to reason about because of
- using synchronous channels), but also because channels are not first
- class objects. When a language allows a channel to itself be a
- first class value, it becomes Turing complete and quite resistant
- to model checking on a practical level. Still, minds far greater
- than mine (Tony Hoare, Robin Milner, Rob Pike, John Reppy) have
- spoken of the benefits of synchronous programming, so I will take
+has received (or vice-versa).
+
+1. Synchronous channels are easier to reason about because there is
+ automatic flow control; the sender does not proceed unless the
+ recipient drains the channel. Tony Hoare, Robin Milner, Rob Pike and John Reppy have
+ all written extensively about synchronous programming, so I will take
their word for it. However, I still find asynchronous programming
(through buffering) a better default choice for practical reasons:
-2. Context switching has a cost, however inexpensive kilim's tasks are
+2. Context switching has a cost, however inexpensive Kilim's tasks are
to create and context-switch (unlike the Occam/transputer world
with its hardware assisted switching). Although Kilim's mailboxes
can be configured to be synchronous, it is not the default. There
@@ -188,7 +183,7 @@ control, timeouts, streaming etc.
Kilim, in a concurrent (local) setting, is at least 100x faster than
Java RMI on even the simplest benchmarks. In a distributed setting,
-the kilim approach is better because asynchronous messaging is much
+the Kilim approach is better because asynchronous messaging is much
more scalable. Combine this with automatic stack management and you
get a far easier programming model
@@ -205,8 +200,8 @@ The notions of procedures calling procedures by building up a stack
has been burnt into our collective programming consciousness. If a()
calls b() calls c(), we think, the stack must be three deep.
-Suppose a() has nothing more to do after calling b(). It really
-doesn't need b() to return, so there is no use pushing a return
+Suppose a() has nothing more to do after calling b(). It (that is, a()) really
+doesn't need b() to return to it, so there is no use pushing a return
address on the stack. In other words, the flow of control _continues_
from a to b, never to return. Most respectable code generators
recognize this special case and prevent the stack from building up
@@ -283,8 +278,7 @@ Are there any disadvantages of continuations? Oh yes. Machines are
so well optimized for stack usage and no tail calls that the
system is biased against continuations, performance-wise. The
continuation object has to be allocated from the heap and depends
-on garbage collection. This is one reason why OCaml doesn't support
-continuations.
+on garbage collection. This is one reason why OCaml doesn't use CPS.
That said, the current crop of garbage collectors and the amortized
cost of garbage collection often matches that of stack-based
@@ -299,4 +293,3 @@ with the Java verifier that doesn't allow random gotos to be inserted
in the code willy-nilly. More details in the paper "A Thread of One's
Own" (included in the docs directory)
-So much for my idea of a few words!
View
@@ -157,9 +157,8 @@ <h1>How does it work?</h1>
debugged inside eclipse)
<p>The transformation is a variation of continuation passing style; the
-details are in the paper entitled "A Thread of Ones Own" presented at
-the Workshop on New Horizons in Compilers (2006). A simple introduction
-to CPS is in the accompanying IFAQ.txt.
+details are in the paper entitled <a href="thread_of_ones_own.pdf">"A Thread of Ones Own"</a> presented at
+the Workshop on New Horizons in Compilers (2006). A simple introduction to CPS is in the accompanying <a href="IFAQ.txt">IFAQ.txt</a>.
<h1>Building, running the examples</h1>
View
@@ -1,35 +1,33 @@
-* {border-style: none; font-family: helvetica;}
+* {
+ line-height: 150%;
+/* font-size: 12pt;*/
+ border-style:none;
+ font-family: verdana, helvetica;
+/* margin: 1em; */
+}
/* Links */
-a:link {color: #ff9b0a; text-decoration:none} /* unvisited link */
-a:visited {color: ff9b0a; text-decoration:none} /* visited link */
-a:hover {color: yellow; font-size: 110%; text-decoration:none} /* mouse over link */
-a:active {color: red} /* selected link */
-
-* {line-height: 150%; font-size: 10pt}
+a:link {color: red; text-decoration:none} /* unvisited link */
+a:visited {color: red; text-decoration:none} /* visited link */
+a:hover {color: blue; background: yellow; text-decoration:none} /* mouse over link */
+a:active {color: grey} /* selected link */
-body {
- min-width: 700px;
- margin: 0px 0; padding: 0px;
+p,pre {
+ line-height: 1.5em
}
-pre {font: 12pt Courier New, Courier;}
-code {font: 12pt Courier New, Courier;}
-
-/* Centered box within body*/
-#content {
- text-align: justify;
- width: 700px;
- margin: 0px auto;
+h1 {
+ background-color: #1bf;
+ Color: white;
+ padding: 5px;
+ padding-left: 20px;
+ margin-left: -20px;
+ margin-right: -20px;
+/* font-size: 15pt;*/
}
-h1 {font-size: 15pt}
-hr {
- height:1px;
- width:100%;
- background-color:#995533;
- color:#995533
-}
+pre {font-family: Monaco, Courier New, Courier; font-size:80%}
+code {font-family: Monaco, Courier New, Courier; font-size:80%}
-/*p + blockquote {margin-bottom:0;margin-top:0}*/
+p code {margin: 5px}

0 comments on commit 03dadd5

Please sign in to comment.