Lecture 2

Review

   sequential program -- process
   concurrent program
      processes + communication + synchronization
      kinds:  multithreaded, parallel, distributed


This Week:  the SR programming language, a way to write concurrent programs

   SR -- Synchronizing Resources
   attributes:  multiparadigm, integrated, free!
   history:  designed in 1980s, book in fall of 1992
             installed on every continent, in use on six of them!
   resources
     SR book
     online:  Web pages
              sample programs in class directory and /home/sr/examples
              man pages


Big Picture

   vms, resources, globals  (drawing to illustrate relationships)

   vm:  virtual machine = address space

   initially have one vm and one resource ("main")


Example Programs (using transparencies) -- hello world and array summation

   syntax
   "packaging"
   I/O, statements
   declaration/statement order -- doesn't matter
   semicolons -- optional (except on same line)
   compilation -- sr
   execution -- a.out


Guarded Commands

   B -> S   B: boolean expression; S: statement list

   if B -> S fi   

   if B1 -> S1 [] B2 -> S2 fi

   if B1 -> S1 [] not B1 -> S2 fi = if B1 -> S1 [] else -> S2 fi

   do B -> S od


Procedures and Functions 

   procedure name(formals) [returns name: type]
     body
   end

   really is an op declaration (header/prototype)
   and a proc declaration (body)

   [a process is basically a procedure that is forked rather
    than called; details next time]

   examples:  transparencies for quadrature and quicksort programs