home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!inmos!wraxall.inmos.co.uk!butcombe!geoffb
- Newsgroups: comp.sys.transputer
- From: geoffb@inmos.co.uk (Geoff Barrett)
- Subject: Re: IS Occam3 recursive?
- Message-ID: <1992Nov12.094835.8563@wraxall.inmos.co.uk>
- X-Newsreader: Tin 1.1 PL5
- References: <1992Nov11.033835.21118@netcom.com>
- Date: Thu, 12 Nov 92 09:48:34 GMT
- Lines: 49
-
- Tim Walker (tsw@netcom.com) wrote:
- :
- : Does anyone know if Occam3 will be recursive? This is a big drawback
- : in Occam2 when trying to implement things like parallel searchs.
- :
- : -- Tim Walker (tsw@netcom.com)
-
- The short answer is `no'.
-
- There is, however, a way to get fixed depth recursion. Suppose the
- definition you want to achieve is:
-
- PROC foo (formals)
- body -- contains call to foo
- :
-
- Then you can achieve recursion to depth n by repeating the code thus:
-
- PROC foo (formals)
- STOP
- :
- PROC foo (formals)
- body -- contains call to foo
- :
- ... repeat n-2 times
- PROC foo (formals)
- body -- contains call to foo
- :
-
- This might be regarded as a dirty hack.
-
- More seriously, it does illustrate an important property of occam
- processes, namely that their workspace requirements can be determined
- statically. If you can't do this, then the implementation of parallel
- processes becomes much more difficult. In current implementations of
- occam, it is possible to allocate a fixed amount of workspace for each
- parallel process. If you allow recursive processes you cannot
- determine statically how much workspace each process will need. This
- means that you have to know what to do with stack overflow when the
- obvious place to extend it has been allocated to something else
- already. If you think you have a solution to this, and it does not
- have an adverse affect on the context switch time, then I will be
- interested to hear it. In general, it is more important for an
- embedded application to be sure of enough space in which to run. After
- all, you don't want to run out of memory just as you reach a critical
- section of control code.
-
- Geoff Barrett
- INMOS Limited
-