Repository navigation
Handling simultaneous events in UnetStack – event serialization vs parallel execution #9
Unanswered
Lucifish21
asked this question in
Q&A
Replies: 1 comment 3 replies
|
Each UnetStack agent runs in its own thread, but all behaviors within an agent are cooperatively multitasked. So behaviors occurring at the same time are implicitly serialized, and you don't need to do anything special to handle race conditions. If the agents interact with each other using messages, as they usually do, no special handling is required to handle race conditions. However, if you directly share a resource across agents, then you will have to handle race conditions yourself using standard Java synchronization primitives. |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi, I’m working on implementing Slotted MAC protocol in UnetStack and have a question about event scheduling.
In NS‑3, when two events are scheduled at exactly the same simulation time (t₁ = t₂), the simulator serializes them (typically using insertion order or event ID), executing them sequentially rather than in parallel. This prevents immediate FSM deadlocks.
Does UnetStack provide a similar mechanism for events scheduled at the same time, or could simultaneous PHY injections from multiple agents lead to race conditions or FSM conflicts?
Any guidance on best practices to avoid such issues in UnetStack would be greatly appreciated.
All reactions