Three mechanisms provided in occam-pi:
• self-recursive procedures
• n-replicated parallel
• asynchronous process invocation (fork)
All three can be modelled in CSP, but require dynamic memory for implementation
The ‘fork’ is examined here
• essentially a procedure instance that runs in parallel with the invoking process
• parameter passing is strictly uni-directional and uses a communication
semantics
ex:-
The only way to communicate with a forked process is to pass to it a mobile channel-end
• ordinary channels are non-communicable
Worker processes are created on demand Process farms are one application of dynamic process creation, that turns out to be useful for many things
• e.g. the occam(-p) web-server (http://wotug.kent.ac.uk/ocweb/)
• more generally, almost any server that must handle multiple clients concurrently
A more interesting example is the “occam-pi adventure”
• an interactive text-based multi-user game (MUD)
• built as an interconnected matrix of ‘rooms’
• ‘objects’ and ‘users’ connect to rooms using mobile channels, also used to link rooms
• exercises channel mobility.
->Game matrix is constructed dynamically.
• may add, remove and re-arrange rooms whilst running.
->User processes connected to the room the user is in
->Objects lie around in rooms or are held by users.
c-pgms.blogspot.com Moved
15 years ago
No comments:
Post a Comment