[Swift-commit] r3294 - text/internals/trunk

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Fri Apr 30 10:19:33 CDT 2010


Author: aespinosa
Date: 2010-04-30 10:19:33 -0500 (Fri, 30 Apr 2010)
New Revision: 3294

Added:
   text/internals/trunk/internals.tex
Log:
Initial draft notes from last week

Added: text/internals/trunk/internals.tex
===================================================================
--- text/internals/trunk/internals.tex	                        (rev 0)
+++ text/internals/trunk/internals.tex	2010-04-30 15:19:33 UTC (rev 3294)
@@ -0,0 +1,148 @@
+\documentclass{article}
+
+\title{Swift Internals}
+\author{
+  Mihael Hategan \\
+  scribe: Allan Espinosa
+}
+
+\begin{document}
+\maketitle
+\section{Provider model}
+Providers are asynchronous.  Internally these are implemented as lightweight
+threads.  It consumes less resources when a job is executing.  Jobs only consume
+resources when submitting a job and receiving a notification when a job
+finished.  In between, the thread is simply waiting for the job to finish.  By
+using lightweight threads, less resources are consumed.
+
+not native threads.  consumes smaller resources when a job is executing. light
+weight threading (green threads: don't consume memory when nothing is running).
+This is how a provider works
+
+{
+Submit()
+addListener()-> called when the job is done. add when you make a submit() job 
+}
+vs
+just runJob()
+
+CPU (on submit site): fill with as much of submission and notification.
+Task
+Handler -> that can actually execute these tasks
+Handler.submit(Task) 
+
+in \verb1 modules/abstract-common1
+src/org/globus/cog/abstraction/impl/common/task
+
+public interface TaskHandler
+public interface Task
+
+
+\section{Karajan}
+
+Stackframes. Every element (execution unit) is a function
+  - java hashtables
+
+procedure invocations gets these 
+
+start()
+waitDone();
+
+everything is asynchronous.
+
+sequential:(
+     job1,
+     job2)
+   job1.start()
+    job1.done() {
+          job2.start()
+        }
+   job2.done() {
+          "i'm done"
+   }
+parallel: (decrements until 0 => done)
+
+That
+  Thread1
+  Thread2
+
+a parenthesis creates a local scope (1 stack frame)
+
+Threads creates a new scopes
+
+partial arguments
+for(i in range(0,10), (do something) )
+
+\section{Swift karajan}
+import("sys.k")
+wait()
+delay()
+sequential()
+parallel()
+
+\section{Futures}
+
+a := future(wait(delay=2000), "A")
+
+[a,b] := seq(1,2)
+
+brackets to combine a multple of l values
+
+echo("o")
+a := future(wait(delay=2000), "A")
+echo("B") executes at t=0
+wait(delay=1000)
+echo("a") - > executes at t=1000
+echo(a) -> executes at t=2000
+
+race(
+  wait(delay=1000)
+  wait(delay=2000)
+) -> slightly parallel
+
+\section{Channels}
+
+import("sys.k")
+
+c := futureChannel(
+  for(i, ranger(0,9)
+    wait(delay=1000), i
+  )
+)
+
+not this: [ future(wait(1000), 0), future(2), future(3)... future(9) ]
+but this: [], [0], [0, 1], [0, 2]
+
+for(j, c, echo(j))
+
+basic concurency book
+
+how swift works:
+Alg 1 (channels)
+c := channel()
+parallel(
+  sequential(
+    wait(delay=1000)
+    append(c,1)
+  )
+  sequential(
+    echo(first(c))
+  )
+)
+
+equivalent swift code:
+c = generate();
+consume(c);
+
+Used for swift arrays
+import("sys.k")
+
+c := futureChannel(
+  for(i, ranger(0,9)
+    wait(delay=1000)
+    list(i, chr(i))
+  )
+)
+
+
+\end{document}




More information about the Swift-commit mailing list