I'm using a bunch of python scripts to simulate sensor network behaviour. In particular, I want to simulate some sensors which asynchronously send readings to a MQTT broker. In order to do that I wrote some scripts where each one represents a different sensor.
Looking at: stackoverflow old question
I preferred not revive an old question. Anyway I used that approach:
script1.py &
script2.py &
script3.py &
script4.py &...
My question is: is that a real concurrency? if I try to print received readings (on console) sometimes I obtain, for instance, some readings belonging to script1, than one from script 3, than four from script 2 and so on... When honestly I expected no consequents readings from the same script. Is this a problem of the printing or maybe the & don't assure a real concurrency between the scripts?
I'm developing with osx.
Maybe there is a more realistic way to simulate sensors behaviour?