[plt-scheme] Defining resource constrained producer/consumer in the simulation package
Hi,
I am trying to define the following producer/consumer process using
the simulation package:
There is a queue of resources of type A.
Process X takes an A and produces a B (which contains the A). The B
is placed in a queue of fixed size
Process Y takes a B, returns the A its queue and throws away the B.
If any queue is empty a process that needs a resource of that type
must wait. If any queue is full a process that creates a resource of
that type must wait.
I can't work out how to model this. If I model the As and Bs as
resources, I have the problem that "It is an error to attempt to
release more units than the process has allocated."
(http://planet.plt-scheme.org/package-source/williams/simulation.plt/2/2/html/simulation-Z-H-8.html#node_sec_7.2.2).
Since X takes A and never releases them, and Y releases As but never
takes them, this is a problem.
If I schedule As and Bs as events how do I enforce the resource limits?
This kind of simulation is simple in a message passing thread system
but I don't see how it fits into the simulation package's model.
Also: the documentation for the simulation package would benefit from
an introductory section that lays out the model used by the package.
Thanks,
Noel