andyr@inmos.com (Andy Rabagliati) (04/19/91)
Running a parallel programming course recently, we wrote solutions in C and occam to the problems below. Problems - 1) A simple buffering problem, consisting of a key from the keyboard travelling through a process pipe and back to the screen, and 2) A ring buffer (single buffer with pointers chasing each other) replacement for the process pipe. Note that the second is an efficient functionally identical replacement for the former, which can be adapted for high performance buffering generally. In that case, The in and out indices can point to arrays of large objects, to save copying. An extra synchronisation step will be needed before incrementing the output index. The result will be a program that obeys strict occam usage rules, but will fail the present generation usage checker. If anyone is interested, I will post a solution to that as well. However, our solutions following all pass the occam usage checker. Anyone care to write a checker for the (functionally identical) C solution ? (-: I also believe they are close to minimal solutions. They make an interesting comparison between the languages. The programs are short, (one pagers) and cover PAR and ALT. There is no attempt to cover Protocols, functions, or even multiply and divide. For those parallel programming hackers, check out our solution to guarded ALTs in C !!! Software - It uses the Inmos D7205 occam compiler, our D7214 C compiler, and the 'Jeff Mock' concurrency library, used by others including Logical Systems, OR. Both these compilers come with the library. Boards - any B004/B008 compatible board, i.e. most of them, including the CSA educational kit. It is probably just a makefile change to port it to a Sun, and any of a number of boards. Solutions follow in a SHAR file. Cheers, Andy Rabagliati EMAIL:- andyr@inmos.COM