From: Giancarlo <wro...@gm...> - 2009-02-16 14:28:09
|
Hi Marcos, Thank you very much for your answer. > The problem is that each entity in GridSim is a thread. Simjava2 works > with two event queues, namely the future event queue and the deferred > event queue. Every time Sim_system class reads the queue of future > events (i.e. at each clock tick), it puts all the next events to be > handles in the deferred queue. If there are multiple events scheduled > for the very same simulation time, they will all be placed in the > deferred queue. After that, Sim_system wakes up all the threads to > consume events. I take a look at the code of simjava and I have another little question about the mechanism you have described, perhaps it's rather a confirmation Running entities will not block on sim_get_next until they have an event waiting for them in the deferred queue. But an event scheduled with delay 0.0 by an entity during a tick run will be put in the future event. So the destination entity for the above event will block on sim_get_next and will see the event after next run of Sim_system.run_tick() method. Is this correct? > Yes, this is a bug and you are not the first one to experience this > problem. I think people had not noticed it before because they were > using Java 1.4. One solution to this problem would consist in making > GridResource send an event to the policy instead of calling a method > from it. By the way, this is the approach suggested in SimJava2's > documentation. The other solution, if you are using the the source > code of GridSim instead of the jar files, is to add some > synchronisation to the allocation policy. I already know about the bug, I was just wondering why the problem wasn't arising if the send with a port was used. Thanks again, Regards, Giancarlo |