diff python/doc/design.rst @ 273:6b3a874edd6e

Added some docs
author Windel Bouwman
date Mon, 02 Sep 2013 17:40:21 +0200
parents e64bae57cda8
children
line wrap: on
line diff
--- a/python/doc/design.rst	Sat Aug 31 17:58:54 2013 +0200
+++ b/python/doc/design.rst	Mon Sep 02 17:40:21 2013 +0200
@@ -1,5 +1,11 @@
+Design
+======
 
-= processes / threads =
+OS
+--
+
+Processes / threads
+~~~~~~~~~~~~~~~~~~~
 
 Processes are completely seperated and fully pre-emptive.
 This means a process can be unscheduled at any moment.
@@ -11,38 +17,40 @@
 If some heavy duty task must be performed, either way spawn
 a new process, or yield frequently from this hard labour.
 
-= tasks =
+tasks
+~~~~~
 
-Consider the following::
+Consider the following:
+
+.. code::
 
---
-function int insanemath(int a)
-{
-    while (a > 0)
+    function int insanemath(int a)
     {
-       a = a -1;
-       resume agent1;
+        while (a > 0)
+        {
+           a = a -1;
+           resume agent1;
+        }
+        return a - 1;
     }
-    return a - 1;
-}
 
-task agent1()
-{
-  start agent2;
-}
+    task agent1()
+    {
+      start agent2;
+    }
 
-task agent2()
-{
-   insanemath(55);
-   insanemath(44);
-}
+    task agent2()
+    {
+       insanemath(55);
+       insanemath(44);
+    }
 
-task main()
-{
-  start agent1;
-  join agent1;
-}
---
+    task main()
+    {
+      start agent1;
+      join agent1;
+    }
+
 
 Say to tasks are running in concurrent / parallel.
 
@@ -64,30 +72,32 @@
 
 Assembly code for the functions above:
 
-.code
-insanemath:
-L1:
-load r0, sp - 4
-cmp r0, 0
-jl L2
-dec r0
-store r0, sp - 4
-jmp L1
-L2:
-ret
+.. code::
+
+    .code
+    insanemath:
+    L1:
+    load r0, sp - 4
+    cmp r0, 0
+    jl L2
+    dec r0
+    store r0, sp - 4
+    jmp L1
+    L2:
+    ret
 
-agent1:
-hlt?
+    agent1:
+    hlt?
 
-agent2:
-hlt?
+    agent2:
+    hlt?
 
-main:
-jmp agent1
+    main:
+    jmp agent1
 
-.data
-agent1_task:
-dd 0
-agent2_task:
-dd 0
+    .data
+    agent1_task:
+    dd 0
+    agent2_task:
+    dd 0