Search code examples
simpy

simpy source code request superclass


I was reading through the simpy source code, and I found that for some reason, Request is a subclass of the Put class. Is there a reason for this? I thought a request was a request to get something out of a resource, not to put something into one?


Solution

  • The idea/abstraction behind this is, that Resource has a "shelf for user tokens". If a user wants to use the resource, they tries to put their token into the resource. They uses the resource until they removes the token.

    If the shelf is already full, new users have to wait until they can place their tokens in it.