From: Marcos D. de A. <ma...@cs...> - 2008-06-24 00:11:48
|
Hi Azin, sorry for the delay in my response. I don't exactly how you are implementing your simulation because I don't have access to its source code, but this is probably not the way to do it. You should always create an entity by extending either Sim_entity of GridSim classes. Sim_entity is a thread, but it differs from a normal java thread in the sense that is aware of the simulation events. Internally, SimJava sets threads to sleep and wakes them up according to simulation events inserted in the queue. If you simply extends a thread that does not take this mechanism into account, the results may vary, but certainly the simulation will not run as expected. Regards, Marcos On 17/06/2008, at 1:09 PM, Azin Moallem wrote: > Hi, > > Thanks for your usefull and descriptive response. While I think the > solution you proposed can help me I have found where the problem is. > When gridletReceive() is invoked while there are actually no events of > type GRIDLET_RETURN the program prints "Sim_system: No more future > events" and seems to even ignore all other incomming GRIDLET_RETURN > events ! > > Is this the case the famework is supposed to work or I am making a > mistake somewhere ?! > > I really appreciate your attention and descriptive responses you > provide > > Azin > > > Marcos Dias de Assuncao wrote: > > >> >> Dear Azin, >> >> Using a thread will not work as you expect. >> >> I think that what you want can be implemented in the following >> manner. You can create a GridSim entity that submits the gridlets as >> you have already created. However, this entity may submit a new >> Gridlet whenever a given internal event is received. As an example, I >> am providing some sample code wherein the entity schedules a new >> Gridlet whenever another returns. The entity's body method would look >> like this: >> >> >> public void body() { >> ... >> int numofGrls = 10; >> int grlReceived = 0; >> >> Sim_event ev = new Sim_event(); >> while (grlReceived < numofGrls) { >> super.sim_get_next(ev); >> if(ev.get_src() == super.get_id() && >> ev.get_tag() == SUBMIT_ONE_MORE_GRIDLET) { >> >> // Submit the gridlet here... >> super.gridletSubmit(gridlet, resID); >> } >> else if (ev.get_tag() == GridSimTags.GRIDLET_RETURN) { >> // add the gridlet to a list, print it or do whatever is required >> here... >> grlReceived++; >> super.sim_schedule(super.get_id(), >> GridSimTags.SCHEDULE_NOW, SUBMIT_ONE_MORE_GRIDLET); >> } >> } >> ... >> } >> >> >> where SUBMIT_ONE_MORE_GRIDLET is just a new tag defined in the class: >> >> private static final int SUBMIT_ONE_MORE_GRIDLET = 5000; >> >> I think this might give you an idea on how it works. >> >> Regards, >> >> Marcos >> >> >> On 16/06/2008, at 12:48 PM, Azin Moallem wrote: >> >>> Hi, >>> >>> I have a question simulating a scheduling algorithm using GridSim >>> and I >>> would be greatful to hear back. >>> >>> I need to simulate a dynamic job submission. I mean while >>> gridlets are >>> being submitted to the grid, completed gridlets are being sent >>> back to >>> users. To do this I am simulating submission of gridlets in the body >>> function of a GridSim entity and receiving back the gridlets is the >>> responsibilty of a Thread which I have created myself. >>> >>> The problem is gridletReceive() always returns null ! and I see this >>> output: "Sim_system: No more future events" early in my simulation. >>> >>> how can i simulate a dynamic job submission environment ? >>> >>> >>> Best, >>> Azin >>> >>> -------------------------------------------------------------------- >>> -- >>> --- >>> Check out the new SourceForge.net Marketplace. >>> It's the best place to buy or sell services for >>> just about anything Open Source. >>> http://sourceforge.net/services/buy/index.php >>> _______________________________________________ >>> Gridsim-users mailing list >>> Gri...@li... >>> https://lists.sourceforge.net/lists/listinfo/gridsim-users >> >> |