[CSUSB] >> [CNS] >> [Comp Sci Dept] >> [R J Botting] >> [CS320 Course Materials] >> [Sebesta] >> [Source]
[Index] [Schedule] [Syllabi] [Text] [Labs] [Projects] [Resources] [Search] [Grading]
Wed Jan 7 15:13:59 PST 2004
. CS320 Notes on Concurrency.
This page:
ASCII format:
	Chapter 13 of Sebesta's Book

. Introduction

In the introduction the book mentions the importance of being able
to think in terms of concurrent (pseudo-concurrent?) process.

First key point: It is very helpful to be able to make a single
processor system work as if it had many processors.

Concurrency does not need their to be real parallel CPUs... as long as
you know how to fake it.

For example much of the power of UNIX comes from being its being a 
multitasking operating system that lets ANY user
	Run competitive concurrent processes
	Run cooperative concurrent processes
without hastle.  See CS360
Also see the `sieve` and `crypto` examples below.

The introductory definitions and ideas are important.

I think you can focus on the techniques implemented in Ada 83 and
Ada 95.  I'm going to add some notes on Concurrency in Java

CS460 has a detailed study of semaphores, monitors, deadlock etc.
However you need to understand these ideas to be able to use Java.

I don't expect you to grasp the different parallel architectures
in this class.  We have an upper division elective on SIMD and MIMD 
systems.  We have several multiprocessor systems for experimental purposes.

The book does not cover:
(1) The UNIX pipe (easy message passing at the program level
(2) OCCAM (A multi-processor language based on Hoare+Dijkstra)
(3) semi-coroutines or restartable subroutines

I have lots of examples of semi-co-routines and other forms of concurrency.
Look in these directories:

(1) UNIX Pipes
A Pipe in UNIX connects the output of one program (any program) to
the input of the other program and then runs them in parallel.
	(ls) -->-- (wc)
For example:
	ls|wc -l
lists your files and counts them.
	ls|grep 320|wc -l
list files, filters out those with '320' in the name and counts them.
	grep -l 320 *|wc -l
counts the number of files with '320' inside them.
	ps -elf|grep $USER
lists all processes and filters out those with your name in them... including
the two processes 'ps -elf' and 'grep'.

For more examples:

Occam is a deliberately simple structured programming language
with built-in concurrency.  It was designed so that a concurrent
program can be written and then compiled so that it runs on
any number of parallel networked machines.  It is one of the few
modern language where the indenting of commands is used by the compiler
to determine the control structure of the program.

(3) Semi-co-routines
Here is another neat form of (pseudo)concurrency.
	See the end of