Topics:
A Process is an object with its own thread of control. i.e. a CO-ROUTINE
Processes run "concurrently", on a conventional processor this means that control is swapped between them. In a simulation, processes persist over time, with their actions interleaved.
A process may be in these states:
Semaphores provide synchronization by "guarding" critical sections, only the designated number of processes can be between WAIT and SIGNAL at any one time:
TYPE GIANTptr = ^ GIANT; GIANT = OBJECT (procdescr) field1: ) ..... ) Globally accessible variables of this process type fieldN: ) constructor init (name:pname, index:integer, ..[specific inits] ) ; {--- OPTIONAL may beef up standard init -- IF SO, MUST CALL ProcDescr.Init (name, index) !!} procedure lifecycle; VIRTUAL; {MUST define a life cycle} [ other special methods ] end;The minimum requirement is:
Giant = object (procdescr) procedure lifecycle; VIRTUAL; end;
procedure GIANT.LifeCycle; var [any private local variables] begin [do this ...] .... [... do that] end;{processes may exhaust life cycle, in which case they terminate themselves, and are removed by the monitor}
VAR bigboy : GiantPtr; NEW (bigboy, init('Rumble-Buffin', 42, ... )); RESUME (bigboy); { to put on ready queue }
Monitor.RunSimulation (time_to_simulate, number_of_samples)The monitor maintains 3 queues: ready, deferred, and sleep. The first process on the ready queue starts running. When a context switch is called for (by one of the above mechanisms), the monitor switches context to either:
Up to top of this document
Back to Simulation notes.
Comments, etc, send to
ljensenn at ubishops.ca