How can I prevent a deadlock state in a SimEvents model using SimEvents R2013b?

1 次查看(过去 30 天)
Two entities are being submitted to two servers, i.e. one entity per server. If server #1 is occupied, it should pause (and block) server #2 until server #1 becomes unoccupied. The same operation occurs if server #2 becomes occupied. At no point in time should both servers be blocked. However, an issue arises if the servers receive the entities at the "same" time, both servers become blocked and thus the system becomes locked. 
The attached model, "simpleExample_eventPrior.slx", demonstrates this behavior.
How can I prevent a deadlock state in a SimEvents model?

采纳的回答

MathWorks Support Team
A method that will provide control to select which block has priority in this case would be to use a MATLAB Function block to break this "deadlock" state. Effectively when both the 'so' outputs from N-Server and N-Server1 are equally 1, preference should be given to one server. The attached example, "simpleExample_eventPrior_TS.slx", demonstrates a possible method to resolve this "deadlock" state.  
Additionally, since these blocks are mutually driving each other, priorities for the ServiceCompletion and the ControlEvent states are executed at different times. For additional information on the priorities and execution order, the SimEvents engine looks to be performing the ServiceCompletion for both N-Servers first in order of their priorities. Then afterwards, when both servers are full, the ControlRequests are evaluated. To further inspect the order of a SimEvents simulation, you can enter debug mode. This can be performed via the following command in the MATLAB command line:
 
>> sedebug('simpleExample_eventPrior')
 
Once in the debugger, the "runtoend" command can be used to generate a log for this particular example. At the end of the log, you can see that the ControlRequests for the servers are evaluated after both servers are already full. Hence, this model will alway end in the deadlock state.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Discrete-Event Simulation 的更多信息

标签

尚未输入任何标签。

产品


版本

R2013b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by