Multiprocessor topology simulator

This is a python script that simulates time steps in the following pipeline multi-processor topology:

We consider that a task needs to get from left to right or vice-versa. One task is described by the number of computations that need to be done on each level.
The connections have limited transmission capacity (or throughput) per time step. The processors have a limited number of computations they can do in each step, regardless of the task. Both connections and processors may have unlimited queue though.
All the computations are considered generic and equally matched as complexity.

Given such a configuration, where processors (0,0) and (0,N+1) have 0 computation capacities and their connections have infinite throughput, the following script simulates time steps for this architecture using threads. The time steps events are separated using a re-entering barrier built with semaphores. Common read/write buffers are also protected for concurrent access.
Test script is not included as I do not have the rights to make it public.

I’ve chosen to select the transmitting connection randomly by “fair dice roll” and has proven very efficient (congestion avoidance by probabilistic dispersion). Be aware that none of the entities knows the specifications of its neighbors.

Free Download: zip Python Multiprocessor Simulation (2.58 KB, zip) - Python script that simulates time steps in a pipeline multi-processor topology. 791 downloads

  • Syrusmahesh

    how to run above code

    • Mihnea Simian

      As I said, “Test script is not included as I do not have the rights to make it public.”
      But I’ll try to write one if you really need one and give you a reply. This is basically just a library of concept models. You need to use the factories – getNewProcessor, getNewConnection – give them ids and link them in the above architecture, and then call the run methods (both processors and connections are actually thread instances) and pass them “task tokens” from main thread.