Simpy - accessing multiple resources


I am starting to learn SimPy DES framework.I want to implement a simulation in which requests arrive at different times to the server. There are different types of requests, each one of them loads server with specific memory/cpu load. So, for instance, there might be requests that typically use 10% of CPU and 100MB of mem, while other requests might need 15% of CPU and 150MB of RAM (those are just example numbers). Server has its own characteristics and some ammount of memory. If a request arrive to server and it does not have required amount of resources ready this request should wait. I know how to handle case of a single resource - I could for instance implement CPU load using Container class with capacity of 100 and initial amount of 100, similarly for mememory. However, how do I implement situation in which my requests should wait for both CPU and memory to be available?

Thanks in advance!


The easiest solution would be to use the AllOf condition event like this:

cpu_req = cpu.get(15) # Request 15% CPU capactiy mem_req = mem.get(10) # Request 10 memories yield cpu_req & mem_req # Wait until we have cpu time and memory yield env.timeout(10) # Use resources for 10 time units

This would cause your process to wait until both request events are triggered. However, if the cpu would be available at t=5 and the memory at t=20, the CPU would be blocked for the whole time (from 5-20 + the time you actually use the CPU).

Might this work for you?


  • Populating H2 database with Spring and jdbc DataSourceTransactionManager
  • psutil error on macos
  • numpy.ndarray objects not garbage collected
  • scala.MatchError: java.lang.StackOverflowError (of class java.lang.StackOverflowError)
  • updating and compacting sqlite database in android
  • How to Upload a file in GWT
  • Eclipse won't start
  • Python: how to split and return a list from a function to avoid memory error
  • App Memory Usage differs between Devices
  • Why isn't Kubernetes service DNS working?
  • TensorFlow C++, runtime issue
  • Program crashes when run outside IDE
  • iOS - Is this a task for enums?
  • Deployments not visible in Kubernetes Dashboard
  • DataGridView: Pass by Value or Reference?
  • What is the equivalent of Android permissions in iOS development? [duplicate]
  • Which browser have this strange user agent? (IOS device)
  • Insertion large number of Entities into SQL Server 2012 [duplicate]
  • jersey/tomcat Description The origin server did not find a current representation for the target res
  • Time out Error in send mail
  • ApplePay PKPaymentAuthorizationViewController always shows processing
  • Bash if statement with multiple conditions
  • Can someone please explain to me in the most layman terms how to use EventArgs?
  • JBoss External Properties Files in Classpath
  • Is there a way to do normal logging with EureakLog?
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • Highlight one bar in a series in highcharts?
  • Control modification in presentation layer
  • Splitting given String into two variables - php
  • NetLogo BehaviorSpace - Measure runs using reporters
  • Is my CUDA kernel really runs on device or is being mistekenly executed by host in emulation?
  • JavaScriptCore crash on iOS9
  • Resize panoramic image to fixed size
  • angularjs unit test when to use $rootScope.$new()
  • Volusion's generic SQL folder, functionality
  • Build own AppleScript numerical error handling
  • Calling of Constructors in a Java
  • PHP: When would you need the self:: keyword?
  • How do you join a server to an Active Directory (domain)?
  • coudnt use logback because of log4j