From: Marcos D. de A. <ma...@cs...> - 2008-06-16 07:49:51
|
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 |