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: Python Multiprocessor Simulation (2.58 KB, zip) - Python script that simulates time steps in a pipeline multi-processor topology. 558 downloads