From: <sul...@us...> - 2007-09-01 02:48:18
|
Revision: 53 http://gridsim.svn.sourceforge.net/gridsim/?rev=53&view=rev Author: sulistio Date: 2007-08-31 19:48:15 -0700 (Fri, 31 Aug 2007) Log Message: ----------- changes for the new release Modified Paths: -------------- trunk/README.txt trunk/changelog.txt trunk/faq.txt trunk/release_note.txt Added Paths: ----------- trunk/javadoc.sh Modified: trunk/README.txt =================================================================== --- trunk/README.txt 2007-09-01 02:32:02 UTC (rev 52) +++ trunk/README.txt 2007-09-01 02:48:15 UTC (rev 53) @@ -1,33 +1,56 @@ + README file -=========== +Author: Anthony Sulistio (September 2007) + Directory Structure of GridSim Toolkit -------------------------------------- -$GRIDSIM/ - examples/ -- GridSim examples, see README.txt for details +$GRIDSIM/ -- the current GridSim directory (top level) + classes/ -- The GridSim class files + doc/ -- GridSim and SimJava API Documentation + eduni/ + gridsim/ + examples/ -- GridSim examples, see examples/README.txt for details jars/ -- jar archives source/ -- The GridSim Java source code gridsim/*.java - gridsim/auction/*.java -- framework for the Auction model - gridsim/datagrid/*.java -- framework for the DataGrid model - gridsim/filter/*.java - gridsim/index/*.java -- framework for the Network model - gridsim/net/*.java - gridsim/util/*.java + gridsim/auction/*.java -- framework for the auction model + gridsim/datagrid/*.java -- framework for the Data Grids model + gridsim/filter/*.java -- filters incoming events + gridsim/index/*.java -- framework for the Grid Info Service model + gridsim/net/*.java -- framework for the network model + gridsim/resFailure/*.java -- framework for the resource failure model + gridsim/util/*.java -- includes some statistics classes. +GridSim APIs and examples are also available on the GridSim website. +If you are looking for applications or programs built on top of GridSim, +such as gridbroker or Visual Modeler, they can be found below: +http://www.gridbus.org/gridsim/release.html + +Software Requirements : Java version 1.4.2 or newer +--------------------- +GridSim has been tested and ran on Sun's Java version 1.4.2 or newer. +Older versions of Java are not compatible. +If you have non-Sun Java version, such as gcj or J++, they may not be compatible. +You also need to install Ant to compile GridSim (explained in more details later). + + Installation and Running GridSim Toolkit ---------------------------------------- +There is no special program to install GridSim. You just need to +unzip the GridSim file to install. +If you want to remove GridSim, then remove the whole $GRIDSIM directory. NOTE: You do not need to compile GridSim source code. The JAR file is provided to compile and to run GridSim applications. Description of the following jar files: -*) gridsim.jar -- contains GridSim and SimJava class files -*) simjava2.jar -- contains SimJava v2.0 class files only +* gridsim.jar -- contains both GridSim and SimJava v2.0 class files +* simjava2.jar -- contains SimJava v2.0 class files only -Example to compile and running GridSim applications, do the following step: +To compile and run GridSim applications, do the following step: 1) Go the directory where the GridSim's Example1 reside In Unix or Linux: cd $GRIDSIM/examples/Example01 In Windows: cd %GRIDSIM%\examples\Example01 @@ -42,6 +65,8 @@ NOTE: * $GRIDSIM or %GRIDSIM% is the location of the GridSim Toolkit package. +* If you are using Java IDEs, such as Eclipse, JBuilder and JCreator, + their instructions (with screenshots) are found on the GridSim website. * Running GridSim of this version requires a lot of memory since there are many objects to be created. Therefore, it is recommended to have at least 512MB RAM or increase JVM heap size when running Java for large simulation experiments. @@ -54,16 +79,18 @@ To understand on how to use GridSim, please go through the examples provided in the $GRIDSIM/examples/ directory. Example 1 - 6 are mainly for beginners, whereas the rest describes more complex GridSim functionalities. +The same examples are also hosted in the GridSim website. At the moment, GridSim has two allocation policies or scheduling algorithms, i.e. First Come First Service (as described in SpaceShared.java) and Round Robin (as described in TimeShared.java). If you are interested in writing a new scheduling algorithm of a resource, then look closely on $GRIDSIM/examples/Example08/ directory. +We are certainly welcomed new additions of allocation policies into GridSim. -Using Ant ---------- +Compiling GridSim : Using Ant +----------------- This release contains a simple buildfile for compiling GridSim classes. You need to have ant installed (http://ant.apache.org/). Ant can be used in both Windows and Unix/Linux environment. @@ -77,23 +104,85 @@ NOTE: * You need to set up PATH for ant in Windows and/or Unix. -* rule for javadoc is not included yet. Use javadoc.sh script instead. +* rule for javadoc is not included yet. Use javadoc.sh script on Unix instead. + Alternatively, the GridSim API can be found below: + http://www.gridbus.org/gridsim/doc/ -Bug Reports and Feedback ------------------------- -Send any queries and feedbacks to ant...@cs... +Contacting Us : subscribe to Mailing Lists at SourceForge.net +------------- +Please read FAQ, examples, API and other documents in the GridSim website +before contacting us. +GridSim mailing lists can be found below: +http://sourceforge.net/projects/gridsim/ then click on the "Mailing Lists" tab. +Please subscribe to the following mailing lists: +gridsim-users (at) lists.sourceforge.net - for any queries and feedbacks +gridsim-developers (at) lists.sourceforge.net - for contributing to GridSim + +Contributors are always needed to improve and maintain GridSim. +Another option is to integrate your work/project into future GridSim releases. +If you want to contribute, advertise yourself to us. +Benefits of your contributions: +- you help future Grid researchers and students like you and us; +- you can proudly write your contributions in the resume or CV; +- you gain knowledge and skills in using SVN version control, Java, and OO; and +- more importantly, you are dealing with a real software engineering development + and working with collaborators or developers from other parts of the world + (at the moment, they are from "down under"). + You can not get this kind of unique experience by doing it yourself or + in university assignments or projects. + +NOTE: +* If you experience some problems when compiling/running GridSim, + write a detailed email. The more information you provide, the better + we analyze your problem. Hence, the sooner we can reply. +* Please send your questions to these mailing lists so that other people can + read and reply them. +* We have hectic schedules, so do not expect an instant reply. + + +Bugs Reporting +-------------- +If you found any bugs, please report them to: +http://sourceforge.net/projects/gridsim/ then click on the "Tracker" tab. + +To prevent any false reports, it is recommended that you email us first on +gridsim-developers (at) lists.sourceforge.net +to identify whether the problem is caused by bugs in the GridSim code +or something else, such as using Java version 1.3. + +Please be specific when you report a bug. We need information such as +GridSim version number, Java version number, detailed descriptions, +snippets of the (buggy) code and any exception errors. +A 'nobody' report in the tracker will probably be ignored. + + +Requesting New Features +----------------------- +If you decide to implement any new features, we will try our best to help you +with directions on where to start and how to design and implement without +breaking the existing design and code respectively. + + Acknowledgement --------------- -* Thank to Gokul Poduval and Chen-Kong Tham for working on gridsim.net package. -* Thank to Uros Cibej for providing build.xml file and instruction on how to - use ant. In addition, he is working on the gridsim.datagrid package. -* Thank to Marcos Dias de Assuncao for working on gridsim.auction package -* Thank to the following people for finding bugs in GridSim: -Anthony Sulistio and Gokul Poduval :) -Uros Cibej, Agustin Herraez, Sai Rahul Reddy, Jakub Milkiewicz, +For their outstanding contributions to GridSim : +* Agustin Caminero from The University of Castilla La Mancha, Spain + for his work on the gridsim.resFailure package. + +* Uros Cibej from The University of Ljubljana, Slovenia + for providing build.xml file and instruction on how to + use ant. In addition, he worked on the gridsim.datagrid package. + +* Gokul Poduval from National University of Singapore + for his work on the gridsim.net package. + +* Marcos Dias de Assuncao from Grids Lab, The University of Melbourne, Australia + for his work on the gridsim.auction package + +We also thank the following people for finding bugs in GridSim : +Gokul Poduval, Uros Cibej, Agustin Caminero, Sai Rahul Reddy, Jakub Milkiewicz, Mads Mbuso Sibeko, Felipe Ramos. - Modified: trunk/changelog.txt =================================================================== --- trunk/changelog.txt 2007-09-01 02:32:02 UTC (rev 52) +++ trunk/changelog.txt 2007-09-01 02:48:15 UTC (rev 53) @@ -1,7 +1,15 @@ # Changelog for GridSim Toolkit -# Maintained by Anthony Sulistio (ant...@cs...) -# $Id: changelog.txt,v 1.4 2006/03/09 07:57:32 anthony Exp $ +# Maintained by Anthony Sulistio +# $Id: changelog.txt,v 1.7 2007/09/01 02:40:12 anthony Exp $ + +Changes from 4.0 to 4.1 +- add a new functionality that supports resource failures during runtime. + This work was done in collaboration with Agustin Caminero from + Universidad de Castilla La Mancha (UCLM), Spain. +- fix few bugs in the code and examples. + +======================================================================= Changes from 3.3 to 4.0 - add two major new features: auction model and data grid - add a new packet scheduler for the network package @@ -13,7 +21,7 @@ ======================================================================= Changes from 3.2 to 3.3 No new additions, it mainly about bug fixes: -- for a Regional GIS feature (discovered by Agustin Herraez). +- for a Regional GIS feature (discovered by Agustin Caminero). Classes affected: AbstractGIS and RegionalGIS - inside GridSim class (discovered by Sai Rahul Reddy) for the below methods: @@ -32,7 +40,8 @@ - a Gridlet must have a ToS for Differentiated network. -- for advanced reservation feature (discovered by Jakub Milkiewicz). +- for advanced reservation feature, queryBusyTime() and queryFreeTime() +needs to know a time zone from user (discovered by Jakub Milkiewicz). ======================================================================= Modified: trunk/faq.txt =================================================================== --- trunk/faq.txt 2007-09-01 02:32:02 UTC (rev 52) +++ trunk/faq.txt 2007-09-01 02:48:15 UTC (rev 53) @@ -1,11 +1,59 @@ # Frequently Asked Questions (FAQ) -# Maintained by Anthony Sulistio (ant...@cs...) -# $Id: faq.txt,v 1.3 2006/03/11 04:49:03 anthony Exp $ +# Maintained by Anthony Sulistio +# $Id: faq.txt,v 1.7 2007/09/01 02:46:01 anthony Exp $ +Please read this document, FAQ, examples, API, etc before contacting us. +Moreover, look at the previous questions at the below website: +http://sourceforge.net/mail/?group_id=94592 -Questions related to GridSim -============================ +Send any queries and feedbacks to gridsim-users @ lists.sourceforge.net +--------------------------------------------------------- +Q: Where can I find gridbroker, visual modeler, ... ? + +A: If you are looking for applications or programs built on top of GridSim, +such as gridbroker or Visual Modeler, they can be found below: +http://www.gridbus.org/gridsim/release.html + +--------------------------------------------------------- +Q: I want to run the gridsim simulation on my computer but i can't because + Jcreator don't see the gridsim package. Please send to me the steps of + how compile and run the simulation. + +A: Go to GridSim website and there is an instruction on how to use it with + JCreator. http://www.gridbus.org/gridsim/paper/jcreator.pdf + + If you use JBuilder or Eclipse, the instructions can be found below: + http://www.gridbus.org/gridsim/paper/jbuilder.pdf + http://www.gridbus.org/gridsim/paper/eclipse.pdf + +--------------------------------------------------------- +Q: I would like to do some experiments for my research work on grid computing + using the simulator package that you have. Using the simulator, + can I simulate a grid environment with service providers requestors, + administartors etc. on a PC environment? Please pass on some resources, + links, and white papers and links where from I should download. + +Q: please help me by sending GridSim Package, give instructions and + also technical help to complete my project successfully. + +A: The best way to learn GridSim is by downloading it from below: + http://www.gridbus.org/gridsim/ + + Go through the provided examples. + In the website, it contains links to papers about GridSim. + + As long as you have JDK version 1.4 onwards, you can run GridSim + on a PC. However, if you run a huge simulation, you'd probably needs + bigger RAM and CPU. + +--------------------------------------------------------- +Q: Will GridSim require Globus? + +A: Why don't you download the GridSim toolkit and have a try? + Also, please read the README file. + +--------------------------------------------------------- Q: How do you compile and run GridSim application? A: For example, if you want to run Example1 @@ -19,8 +67,8 @@ In Windows: * go to the directory of where Example1 resides, i.e. at command prompt type: cd %GRIDSIM%\examples\Example01 - * to compile type: javac -classpath %GRIDSIM%\gridsim.jar:. Example1.java - * to run type: java -classpath gridsim.jar:. Example1 + * to compile type: javac -classpath %GRIDSIM%\gridsim.jar;. Example1.java + * to run type: java -classpath gridsim.jar;. Example1 The main difference is the use of ":" for Unix/Linux, and ";" for Windows @@ -176,6 +224,8 @@ A: For older GridSim versions, it runs one PE. Since GridSim ver3.0, each Gridlet can ask to be run on multiple PEs. However, it is up to the scheduler to handle this. + At the moment, by default, TimeShared and SpaceShared scheduler executes + an incoming Gridlet to only 1 PE. --------------------------------------------------------- Q: Is the model for parallel job included inside the GridSim? @@ -198,28 +248,76 @@ a different response that doesn't exist, etc ... --------------------------------------------------------- -Q: Does GridSim currently support the usage of any wireless network standard +Q: Does GridSim currently support the usage of any wireless network standard when specifying network topology? -A: No. We have NOT done so much about wireless network support in GridSim. - But if you are willing, we could explore this with you. +A: No. We have NOT done so much about wireless network support in GridSim. + But if you are willing, we could explore this with you. --------------------------------------------------------- Q: Does GridSim support multiple simulations or runs in a single program? A: No. Currently, GridSim only allows a single experiment to run in a main() - method. Hence, to calculate a confidence interval, you need to do this + method. Hence, to calculate a confidence interval, you need to do this manually. --------------------------------------------------------- Q: Does GridSim run in a cluster or a PC? -A: GridSim runs in a PC as a stand-alone program with multiple threads. +A: GridSim runs in a PC as a stand-alone program with multiple threads. This means if you want to run in a cluster, you just need to request 1 node. --------------------------------------------------------- +Q: I came across three variables: peak load, off-peak load and holiday load. + I understand from the study I have done that these variables represent + the load factor. I do not fully get what this means and was hoping that + you could help me out so I can progress further with my work. +A: These load factors are influencing the total execution time + of a job in a given resource. + If you set these loads to zero, means this resource is idle / free. + If you want to write a resource scheduler, like SpaceShared or TimeShared + then these load factors are important. +--------------------------------------------------------- +Q: for the Gridlet class, what are the units of file size, length, and output? + +A: the unit of file size and output is in byte. + For the Gridlet length, the unit is in MI (Millions Instructions). + A CPU clock is measured in MIPS (Millions Instructions Per Second) as + suggested by SPEC. + +--------------------------------------------------------- +Q: In the previous releases of GridSim you had to use +GridSim class to send messages to other entities. The provided "send" methods +included a parameter to indicate the sender of the request. It is no clear how +to indicate this with the "send" methods provided by the GridSimCore class. The +lack of ID information in the event raises an exception in the GridResource +class. Reading the source code of the GridResource class I've realized that the +way to send the ID of the sender could be the following: + +super.send(resourceId, GridSimTags.SCHEDULE_NOW, +GridSimTags.RESOURCE_CHARACTERISTICS, new Integer(this.get_id())); + +This solves the first problem but generates a new exception in other class: +Exception in thread "Thread-7" java.lang.ArrayIndexOutOfBoundsException: -1 + at java.util.ArrayList.get(ArrayList.java:323) + at eduni.simjava.Sim_system.send(Sim_system.java:600) + at eduni.simjava.Sim_entity.sim_schedule(Sim_entity.java:342) + at gridsim.net.Output.defaultSend(Unknown Source) + at gridsim.net.Output.body(Unknown Source) + at eduni.simjava.Sim_entity.run(Sim_entity.java:603) + +I've read the source of the Output class, but I've not found a solution to the +problem. Do you know where can be the problem? + +A: The problem was in the "baudRate" attribute that wasn't initialized. +So using GridSim(String name, double baudRate) the problem was solved. + +--------------------------------------------------------- + + + Questions related to GridBroker =============================== @@ -229,7 +327,32 @@ you use gridbroker.jar. Inside this jar file, it contains GridBroker, GridSim and SimJava classes. + Please do not use recent GridSim release jar file when running this broker + (see the below question). + --------------------------------------------------------- +Q: I have executed all gridsim examples. But while executing gridbroker +i.e C:\gridsimtoolkit-4.0\application\gridbroker\example\Example1.java +it gives following error after initializing gridsim: + +Initialising... +Starting GridSim version 4.0 +Entities started. +java.lang.IncompatibleClassChangeError + at gridbroker.Broker.body( Broker.java:649) + at eduni.simjava.Sim_entity.run(Sim_entity.java:603) + + +A: read the README.txt file located under $GRIDSIM/application/gridbroker. +./gridbroker.jar - A jar file containing GridBroker, GridSim v2.1, and + SimJava v1.2 classes. +NOTE: No updates or improvements on GridBroker package since GridSim v2.1, +hence, it is more stable under GridSim v2.1 and SimJava v1.2 release. + +You cant mixed up jars from different class versions. +That's why you have this error message. + +--------------------------------------------------------- Q: I want to create a specific application. Is it necessary to build on top of GridBroker? @@ -333,6 +456,3 @@ a valid entity name compare to the previous release. Hence, to fix this problem is to remove the unnecessary empty space, i.e. "GridResource 0" becomes "GridResource_0" - - - Added: trunk/javadoc.sh =================================================================== --- trunk/javadoc.sh (rev 0) +++ trunk/javadoc.sh 2007-09-01 02:48:15 UTC (rev 53) @@ -0,0 +1,33 @@ + +## A script to run javadoc (Anthony Sept 2004). + +year="2007" # year +ver="v4.1" # version number + +dir=./source # source directory that contains Java files +doc=./doc # output directory + +# Only creates GridSim javadoc. +javadoc -author -version -package -noqualifier java.* \ + -windowtitle 'GridSim '$ver' API Specification' \ + -doctitle '<b>GridSim</b> '$ver' API Specification' \ + -header '<b>GridSim</b><br><font size='-1'>'$ver'</font>' \ + -bottom 'The University of Melbourne, Australia, '$year \ + -d $doc -breakiterator \ + -tag pre:a:"Pre Condition:" \ + -tag post:a:"Post Condition:" \ + -tag invariant:t:"Invariant:" \ + $dir/gridsim/*.java \ + $dir/gridsim/util/*.java \ + $dir/gridsim/net/*.java \ + $dir/gridsim/filter/*.java \ + $dir/gridsim/index/*.java \ + $dir/gridsim/resFailure/*.java \ + $dir/gridsim/auction/*.java \ + $dir/gridsim/datagrid/*.java \ + $dir/gridsim/datagrid/filter/*.java \ + $dir/gridsim/datagrid/index/*.java \ + $dir/gridsim/datagrid/storage/*.java + +echo "javadoc is done ...." + Modified: trunk/release_note.txt =================================================================== --- trunk/release_note.txt 2007-09-01 02:32:02 UTC (rev 52) +++ trunk/release_note.txt 2007-09-01 02:48:15 UTC (rev 53) @@ -1,55 +1,56 @@ -Gridbus Project To Release GridSim Toolkit 4.0 + Gridbus Project to Release GridSim Toolkit 4.1 + September 2007 -The Gridbus Project and the GRIDS (Grid Computing and Distributed Systems) -Lab at the University of Melbourne, Australia has released the -next-version of Grid simulation software, the GridSim Toolkit 4.0. -The new version of GridSim -- add two major new features: auction model and data grid -- add a new packet scheduler for the network package -- add a network reader to read a network topology from a file and automatically -creates and link routers -- modify some of the network classes to incorporate this new packet scheduler -- fix few bugs +The Gridbus Project at The University of Melbourne, Australia has released the +next-version of Grid simulation software, the GridSim Toolkit 4.1. +The new version of GridSim adds a new functionality that supports +resource failures and failure detection of Grid resources. This work was done +in collaboration with Agustin Caminero, a Phd student from +Universidad de Castilla La Mancha (UCLM), Spain. All components developed as part of the GridSim Toolkit are released as "open source" under the GPL license to encourage innovation and pass full -freedom to our users. +freedom to our users. In addition, we have decided to use +SourceForge (http://sourceforge.net/projects/gridsim) for hosting +our future releases and developments. This allows us to share and +and to collaborate further on new functionalities. +Therefore, contributions to the GridSim Toolkit are greatly appreciated. The early version of our GridSim toolkit has been used/dowloaded by several academic and commercial organizations around the world including: -California Institute of Technology, Argonne National Labs, -University of Illinois, Manchester University, CERN, Carleton University, -University of Ljubljana, National University of Singapore, -Universidad de Castilla-La Mancha (UCLM) Spain, -Federal University of Ceara (UFC) Brazil, Brunel University UK, -Indian Institute of Technology, Tsinghua University, Sun Microsystems, -IBM, Unisys, HP, British Telecom and EMC Corp. +University of Southern California (USA), California Institute of Technology (USA), +Argonne National Labs (USA), University of Manchester (UK), CERN, +Universidad de Santiago de Compostela (Spain), Indian Institute of Technology, +Tsinghua University (China), Sun Microsystems, IBM Research, Unisys, HP, +Northrop Grumman Information Technology, British Telecom and EMC Corp. The GridSim software has been used for modeling and simulating many -interesting systems. For example, Unisys's usage in data center modeling -and University of Ljubljana's extension of GridSim to support DataGrid. -Our own usages include simulating economic Grid scheduler in a competitive +interesting systems and ideas. For example, IBM Research uses our DataGrid +package to simulate a grid meta-scheduler that tightly integrates +the compute and data transfer times of each job. +Another example is Universidad de Santiago de Compostela's extension of GridSim +to optimize execution of parallel applications on a Grid. +Our own uses include simulating economic Grid scheduler in a competitive economy model, economic based cluster scheduler and cooperative Grid federation. -The contributors to the GridSim software (early/new version) are: -* Rajkumar Buyya, GridS Lab @ The University of Melbourne. -* Manzur Murshed, GSCIT @ Monash University. -* Anthony Sulistio, GridS Lab @ The University of Melbourne. +The contributors to the GridSim software (from early to new version) are: +* Rajkumar Buyya, GRIDS Lab @ The University of Melbourne. +* Manzur Murshed, GSCIT @ Monash University, Australia. +* Anthony Sulistio, GRIDS Lab @ The University of Melbourne. * Gokul Poduval and Chen-Khong Tham, Dept. of Electrical & Computer Engineering @ National University of Singapore. -* Uros Cibej and Borut Robic, - Faculty of Computer and Information Service, +* Marcos Dias de Assuncao, GRIDS Lab @ The University of Melbourne. +* Uros Cibej and Borut Robic, Faculty of Computer and Information Service, The University of Ljubljana, Slovenia. -* Marcos Dias de Assuncao, GridS Lab @ The University of Melbourne. +* Agustin Caminero, Department of Computing Systems, + Universidad de Castilla La Mancha (UCLM), Spain. -GridSim visual modeller by: -* Anthony Sulistio, GridS Lab @ The University of Melbourne. -* Chee Shin Yeo, GridS Lab @ The University of Melbourne. -To download the GridSim software, usage documents and examples, -please visit the Gridbus Project Web site at +To download the GridSim software, please visit the Gridbus Project web site at http://www.gridbus.org/gridsim/ +Join the GridSim mailing lists at +http://sourceforge.net/projects/gridsim This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2008-05-27 07:55:38
|
Revision: 175 http://gridsim.svn.sourceforge.net/gridsim/?rev=175&view=rev Author: marcos_dias Date: 2008-05-27 00:55:44 -0700 (Tue, 27 May 2008) Log Message: ----------- This update includes and example on how to use the continuous double auction. It also allows the user to change the id of an auction. Modified Paths: -------------- trunk/source/gridsim/auction/Auction.java Added Paths: ----------- trunk/examples/Auction/AuctionEx03/ trunk/examples/Auction/AuctionEx03/AuctionResource.java trunk/examples/Auction/AuctionEx03/Broker.java trunk/examples/Auction/AuctionEx03/ExampleAuction.java trunk/examples/Auction/AuctionEx03/NetUser.java trunk/examples/Auction/AuctionEx03/README.txt trunk/examples/Auction/AuctionEx03/ResponderImpl.java trunk/examples/Auction/AuctionEx03/output.txt Added: trunk/examples/Auction/AuctionEx03/AuctionResource.java =================================================================== --- trunk/examples/Auction/AuctionEx03/AuctionResource.java (rev 0) +++ trunk/examples/Auction/AuctionEx03/AuctionResource.java 2008-05-27 07:55:44 UTC (rev 175) @@ -0,0 +1,182 @@ +/* + * Author: Marcos Dias de Assuncao + * Date: May 2008 + * Description: A simple program to demonstrate of how to use GridSim + * auction extension package. + * This example shows how to create user, resource, auctioneer + * and auction entities connected via a network topology, + * using link and router. + * + */ + +import eduni.simjava.Sim_event; +import eduni.simjava.distributions.ContinuousGenerator; +import eduni.simjava.distributions.Sim_uniform_obj; +import gridsim.AllocPolicy; +import gridsim.GridResource; +import gridsim.GridSimTags; +import gridsim.ResourceCalendar; +import gridsim.ResourceCharacteristics; +import gridsim.auction.AuctionObserver; +import gridsim.auction.AuctionTags; +import gridsim.auction.MessageAsk; +import gridsim.auction.Responder; +import gridsim.net.Link; + +import java.util.Calendar; + +/** + * This class implements a resource that has an observer for an auction + * + * @author Marcos Dias de Assuncao + */ +public class AuctionResource extends GridResource { + private AuctionObserver observer; + private ContinuousGenerator priceGenerator; + private int secondsBetweenAsks = 60; + private int auctioneerId = -1; + + // a tag ID to be used to schedule an event to this entity to create an ask + private static final int CREATE_ASK_TAG = 7001; + + /** + * Allocates a new GridResource object. + * + * @param name the name to be associated with this entity (as + * required by Sim_entity class from simjava package) + * @param baud_rate network communication or bandwidth speed + * @param resource an object of ResourceCharacteristics + * @param calendar an object of ResourceCalendar + * @param policy a scheduling policy for this Grid resource. If no + * scheduling policy is defined, the default one is + * <tt>SpaceShared</tt> + * @throws Exception This happens when one of the following scenarios occur: + * <ul> + * <li> creating this entity before initializing GridSim package + * <li> this entity name is <tt>null</tt> or empty + * <li> this entity has <tt>zero</tt> number of PEs (Processing + * Elements). <br> + * No PEs mean the Gridlets can't be processed. + * A GridResource must contain one or more Machines. + * A Machine must contain one or more PEs. + * </ul> + * @see gridsim.GridResource#GridResource(String, double, ResourceCharacteristics, ResourceCalendar, AllocPolicy) + */ + public AuctionResource(String name, double baud_rate, + ResourceCharacteristics resource, + ResourceCalendar calendar, + AllocPolicy policy) throws Exception{ + + super(name,baud_rate,resource,calendar,policy); + + Responder responder = new ResponderImpl(resource,calendar,policy); + observer = new AuctionObserver(this.get_id(),"Observer_1",this.output,responder); + } + + /** + * Allocates a new GridResource object. When making a different type of + * GridResource object, use this constructor and then overrides + * {@link #processOtherEvent(Sim_event)}. + * + * @param name the name to be associated with this entity (as + * required by Sim_entity class from simjava package) + * @param link the link that will be used to connect this + * GridResource to another Entity or Router. + * @param resource an object of ResourceCharacteristics + * @param calendar an object of ResourceCalendar + * @param policy a scheduling policy for this Grid resource. If no + * scheduling policy is defined, the default one is + * <tt>SpaceShared</tt> + * @throws Exception This happens when one of the following scenarios occur: + * <ul> + * <li> creating this entity before initializing GridSim package + * <li> this entity name is <tt>null</tt> or empty + * <li> this entity has <tt>zero</tt> number of PEs (Processing + * Elements). <br> + * No PEs mean the Gridlets can't be processed. + * A GridResource must contain one or more Machines. + * A Machine must contain one or more PEs. + * </ul> + * @see gridsim.GridSim#init(int, Calendar, boolean, String[], String[], + * String) + * @see gridsim.AllocPolicy + * @pre name != null + * @pre link != null + * @pre resource != null + * @pre calendar != null + * @pre policy != null + * @post $none + */ + public AuctionResource(String name, Link link, + ResourceCharacteristics resource, + ResourceCalendar calendar, + AllocPolicy policy) throws Exception{ + + super(name,link,resource,calendar,policy); + + Responder responder = new ResponderImpl(resource,calendar,policy); + observer = new AuctionObserver(this.get_id(),"Observer_1",this.output,responder); + } + + /** + * Returns the auction observer for this resource + * @param observer + * @return the observer for this resource + */ + public boolean setAuctionObserver(AuctionObserver observer){ + if(observer == null) + return false; + + this.observer = observer; + return true; + } + + /** + * Defines the behaviour of this entity + */ + public void body() { + // creates a uniform distribution to create prices between $1 and $2 + long seed = 11L*13*17*19*23+1; + priceGenerator = new Sim_uniform_obj("priceGen", 1, 2, seed); + super.sim_schedule(super.get_id(), secondsBetweenAsks, CREATE_ASK_TAG); + super.body(); + } + + /** + * Since we are implementing other resource, this method has to be + * implemented in order to make resource able to deal with other kind + * of events. + * This method is called by {@link #body()} for incoming unknown tags. + * + * @param ev a Sim_event object + * @pre ev != null + * @post $none + */ + protected void processOtherEvent(Sim_event ev){ + if(ev.get_tag() == CREATE_ASK_TAG) { + createAsk(); + super.sim_schedule(super.get_id(), secondsBetweenAsks, CREATE_ASK_TAG); + } + else { + observer.processEvent(ev); + } + } + + /** + * Sets the ID of the auctioneer to whom this resource will send asks + * @param id the auctioneer's ID + */ + public void setAuctioneerID(int id) { + auctioneerId = id; + } + + /* + * Creates an ask and sends it to the auctioneer + */ + private void createAsk() { + float price = (float)priceGenerator.sample(); + MessageAsk ask = new MessageAsk(0, AuctionTags.CONTINUOUS_DOUBLE_AUCTION, price); + ask.setSourceID(super.get_id()); + super.send(auctioneerId, GridSimTags.SCHEDULE_NOW, AuctionTags.AUCTION_ASK, ask); + } +} \ No newline at end of file Added: trunk/examples/Auction/AuctionEx03/Broker.java =================================================================== --- trunk/examples/Auction/AuctionEx03/Broker.java (rev 0) +++ trunk/examples/Auction/AuctionEx03/Broker.java 2008-05-27 07:55:44 UTC (rev 175) @@ -0,0 +1,122 @@ +/* + * Author: Marcos Dias de Assuncao + * Date: May 2008 + * Description: A simple program to demonstrate of how to use GridSim + * auction extension package. + * This example shows how to create user, resource, auctioneer + * and auction entities connected via a network topology, + * using link and router. + */ + +import eduni.simjava.Sim_event; +import eduni.simjava.Sim_port; +import gridsim.GridSimTags; +import gridsim.Gridlet; +import gridsim.auction.Auction; +import gridsim.auction.Auctioneer; +import gridsim.auction.ContinuousDoubleAuction; +import gridsim.auction.MessageAsk; +import gridsim.auction.MessageBid; +import gridsim.net.SimpleLink; + +/** + * This class implements a broker for the user. The broker bids containing jobs + * from the users, behaves as an auctioneer, creates a double auction, and submits + * jobs after a match of ask and bid is found. + * + * @author Marcos Dias de Assuncao + */ +public class Broker extends Auctioneer { + private ContinuousDoubleAuction auction = null; + private int numUsers; + private int finishedUsers = 0; + protected static final int FINISHED_EXPERIMENTS = 7002; + + /** + * Constructor + * @param name a name for the broker + * @param baud_rate the baud rate of the link to which the broker is attached + * @param delay the delay of the link + * @param MTU the maximum transfer unit of the link + * @throws Exception + * @see gridsim.auction.Auctioneer + * @see gridsim.GridSim + */ + public Broker(String name, double baud_rate, double delay, + int MTU, int numUsers) throws Exception{ + super( name, new SimpleLink(name+"_link",baud_rate,delay, MTU) ); + this.numUsers = numUsers; + } + + /** + * Returns the output port of the broker + * @return a port which corresponds to the output port of the entity + */ + public Sim_port getOutputPort(){ + return this.output; + } + + /** + * This method is called when an auction is finished + * @see gridsim.auction.Auctioneer#onAuctionClose(gridsim.auction.Auction) + */ + public synchronized void onAuctionClose(Auction auction){ + return; + } + + /** + * This method is called when a match for a double auction is found. + * OBS: We don't use double auctions in this example + * @see gridsim.auction.Auctioneer#onResponseToAsk(gridsim.auction.MessageAsk, gridsim.auction.MessageBid, double) + */ + public synchronized void onResponseToAsk(MessageAsk ask, MessageBid bid, double price){ + Gridlet job = (Gridlet)bid.getAttribute("job"); + + System.out.println("\nA MATCH of an ASK with a BID has been performed:" + + "\nBID details:" + + "\nSender's ID: " + bid.getSourceID() + + "\nPrice offered for executing the job: " + bid.getPrice() + + "\nASK details:" + + "\nSender's ID: " + ask.getSourceID() + + "\nPrice asked for executing the job: " + ask.getPrice() + + "\nPrice given by the auctioneer: " + price); + + gridletSubmit(job, ask.getSourceID()); + } + + public void body() { + try { + // waits 10 second to start the auction + super.gridSimHold(10.0); + + auction = + new ContinuousDoubleAuction(super.get_name() + "_CDA", super.get_id(), + Double.MAX_VALUE, this.output); + + System.out.println("Creating Auction " + auction.getAuctionID()); + + // add the auction + super.addAuction(auction); + + // start the auction + super.startAuction(auction.getAuctionID()); + + } catch (Exception e) { + e.printStackTrace(); + } + + super.body(); + } + + public void processOtherEvent(Sim_event ev) { + + if(ev.get_tag() == Broker.FINISHED_EXPERIMENTS) { + finishedUsers++; + } + + if(finishedUsers >= numUsers) { + super.send(auction.get_id(), GridSimTags.SCHEDULE_NOW, GridSimTags.END_OF_SIMULATION); + super.send(super.get_id(), 0, GridSimTags.END_OF_SIMULATION); + } + } +} Added: trunk/examples/Auction/AuctionEx03/ExampleAuction.java =================================================================== --- trunk/examples/Auction/AuctionEx03/ExampleAuction.java (rev 0) +++ trunk/examples/Auction/AuctionEx03/ExampleAuction.java 2008-05-27 07:55:44 UTC (rev 175) @@ -0,0 +1,304 @@ +/* + * Author: Marcos Dias de Assuncao + * Date: May 2008 + * Description: A simple program to demonstrate of how to use GridSim + * auction extension package. + * This example shows how to create user, resource, auctioneer + * and auction entities connected via a network topology, + * using link and router. + * + */ + +import eduni.simjava.distributions.Sim_uniform_obj; +import gridsim.GridResource; +import gridsim.GridSim; +import gridsim.Machine; +import gridsim.MachineList; +import gridsim.PE; +import gridsim.PEList; +import gridsim.ResourceCalendar; +import gridsim.ResourceCharacteristics; +import gridsim.net.FIFOScheduler; +import gridsim.net.Link; +import gridsim.net.RIPRouter; +import gridsim.net.Router; +import gridsim.net.SimpleLink; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.LinkedList; + +/** + * This class creates resources, users and routers and links them + * in a network topology. This examples uses a continuous double auction. + * + * @author Marcos Dias de Assuncao + */ +public class ExampleAuction { + + /** + * Creates one Grid resource. A Grid resource contains one or more + * Machines. Similarly, a Machine contains one or more PEs (Processing + * Elements or CPUs). + * <p> + * In this simple example, we are simulating one Grid resource with three + * Machines that contains one or more PEs. + * @param name a Grid Resource name + * @param baud_rate the bandwidth of this entity + * @param delay the propagation delay + * @param MTU Maximum Transmission Unit + * @param cost the cost of using this resource + * @param mips Capability of a CPU in MIPS + * @return a GridResource object + */ + private static GridResource createGridResource(String name, + double baud_rate, double delay, int MTU, + double cost, int mips, int auctioneerId) + { + System.out.println(); + System.out.println("Starting to create one Grid resource with " + + "3 Machines"); + + // Here are the steps needed to create a Grid resource: + // 1. We need to create an object of MachineList to store one or more + // Machines + MachineList mList = new MachineList(); + //System.out.println("Creates a Machine list"); + + + // 2. A Machine contains one or more PEs or CPUs. Therefore, should + // create an object of PEList to store these PEs before creating + // a Machine. + PEList peList1 = new PEList(); + //System.out.println("Creates a PE list for the 1st Machine"); + + + // 3. Create PEs and add these into an object of PEList. + // In this example, we are using a resource from + // hpc420.hpcc.jp, AIST, Tokyo, Japan + // Note: these data are taken the from GridSim paper, page 25. + // In this example, all PEs has the same MIPS (Millions + // Instruction Per Second) Rating for a Machine. + peList1.add( new PE(0, mips) ); // need to store PE id and MIPS Rating + peList1.add( new PE(1, mips) ); + peList1.add( new PE(2, mips) ); + peList1.add( new PE(3, mips) ); + //System.out.println("Creates 4 PEs with same MIPS Rating and put them"+ + // " into the PE list"); + + + // 4. Create one Machine with its id and list of PEs or CPUs + mList.add( new Machine(0, peList1) ); // First Machine + //System.out.println("Creates the 1st Machine that has 4 PEs and " + + // "stores it into the Machine list"); + //System.out.println(); + + // 5. Repeat the process from 2 if we want to create more Machines + // In this example, the AIST in Japan has 3 Machines with same + // MIPS Rating but different PEs. + // NOTE: if you only want to create one Machine for one Grid resource, + // then you could skip this step. + PEList peList2 = new PEList(); + //System.out.println("Creates a PE list for the 2nd Machine"); + + peList2.add( new PE(0, mips) ); + peList2.add( new PE(1, mips) ); + peList2.add( new PE(2, mips) ); + peList2.add( new PE(3, mips) ); + //System.out.println("Creates 4 PEs with same MIPS Rating and put them"+ + // " into the PE list"); + + mList.add( new Machine(1, peList2) ); // Second Machine + //System.out.println("Creates the 2nd Machine that has 4 PEs and " + + // "stores it into the Machine list"); + //System.out.println(); + + PEList peList3 = new PEList(); + //System.out.println("Creates a PE list for the 3rd Machine"); + + peList3.add( new PE(0, mips) ); + peList3.add( new PE(1, mips) ); + //System.out.println("Creates 2 PEs with same MIPS Rating and put them"+ + // " into the PE list"); + + mList.add( new Machine(2, peList3) ); // Third Machine + //System.out.println("Creates the 3rd Machine that has 2 PEs and " + + // "stores it into the Machine list"); + //System.out.println(); + + // 6. Create a ResourceCharacteristics object that stores the + // properties of a Grid resource: architecture, OS, list of + // Machines, allocation policy: time- or space-shared, time zone + // and its price (G$/PE time unit). + String arch = "Sun Ultra"; // system architecture + String os = "Solaris"; // operating system + double time_zone = 9.0; // time zone this resource located + + ResourceCharacteristics resConfig = new ResourceCharacteristics( + arch, os, mList, ResourceCharacteristics.TIME_SHARED, + time_zone, cost); + + //System.out.println("Creates the properties of a Grid resource and " + + // "stores the Machine list"); + + // 7. Finally, we need to create a GridResource object. + long seed = 11L*13*17*19*23+1; + double peakLoad = 0.0; // the resource load during peak hour + double offPeakLoad = 0.0; // the resource load during off-peak hr + double holidayLoad = 0.0; // the resource load during holiday + + // incorporates weekends so the grid resource is on 7 days a week + LinkedList weekends = new LinkedList(); + weekends.add(new Integer(Calendar.SATURDAY)); + weekends.add(new Integer(Calendar.SUNDAY)); + + // incorporates holidays. However, no holidays are set in this example + LinkedList holidays = new LinkedList(); + + ResourceCalendar calendar = new ResourceCalendar(time_zone, peakLoad, + offPeakLoad, holidayLoad, weekends, holidays, seed); + + AuctionResource gridRes = null; + try + { + // creates a GridResource with a link + gridRes = new AuctionResource(name, + new SimpleLink(name + "_link", baud_rate, delay, MTU), + resConfig,calendar, null); + + gridRes.setAuctioneerID(auctioneerId); + } + catch (Exception e) { + e.printStackTrace(); + } + + System.out.println("Finally, creates one Grid resource (name: " + name + + " - id: " + gridRes.get_id() + ")"); + + System.out.println(); + return gridRes; + } + + /** + * + * @param args + */ + public static void main(String[] args) { + try{ + Calendar calendar = Calendar.getInstance(); + boolean trace_flag = true; // mean trace GridSim events + int num_user = 3; + int num_resource = 2; + int num_gridlet = 3; + + // First step: Initialize the GridSim package. It should be called + // before creating any entities. We can't run GridResource + // entity without initializing GridSim first. We will get run-time + // exception error. + + // Initialize the GridSim package + System.out.println("Initializing GridSim package"); + GridSim.init(num_user, calendar, trace_flag); + + double baud_rate = 1000; // bits/sec + double propDelay = 10; // propagation delay in millisecond + int mtu = 1500; // max. transmission unit in byte + + long seed = 11L*13*17*19*23+1; + + Sim_uniform_obj genCost = new Sim_uniform_obj("cost",1,2, seed); + Sim_uniform_obj genMIPS = new Sim_uniform_obj("mips",300,400, seed); + + + Broker broker = new Broker("Broker", baud_rate, propDelay, mtu, num_user); + + // more resources can be created by + // setting num_resource to an appropriate value + ArrayList resList = new ArrayList(num_resource); + for (int i = 0; i < num_resource; i++) { + GridResource res = createGridResource("Resource_"+i, baud_rate, + propDelay, mtu, genCost.sample(), + ((int)genMIPS.sample()), broker.get_id()); + // add a resource into a list + resList.add(res); + } + + // create users + ArrayList userList = new ArrayList(num_user); + for (int i = 0; i < num_user; i++) + { + NetUser user = new NetUser("User_" + i, num_gridlet, + baud_rate, propDelay, mtu, broker); + + // add a user into a list + userList.add(user); + } + + ////////////////////////////////////////// + // Fourth step: Builds the network topology among entities. + + // In this example, the topology is: + // user(s) --1Mb/s-- r1 --10Mb/s-- r2 --1Mb/s-- GridResource(s) + + // create the routers. + // If trace_flag is set to "true", then this experiment will create + // the following files (apart from sim_trace and sim_report): + // - router1_report.csv + // - router2_report.csv + Router r1 = new RIPRouter("router1", trace_flag); // router 1 + Router r2 = new RIPRouter("router2", trace_flag); // router 2 + + FIFOScheduler brokerSched = new FIFOScheduler("NetBrokerSched"); + r1.attachHost(broker, brokerSched); + + // connect all user entities with r1 with 1Mb/s connection + // For each host, specify which PacketScheduler entity to use. + NetUser user = null; + for (int i = 0; i < userList.size(); i++) + { + // A First In First Out Scheduler is being used here. + // SCFQScheduler can be used for more fairness + FIFOScheduler userSched = new FIFOScheduler("NetUserSched_"+i); + user = (NetUser) userList.get(i); + r1.attachHost(user, userSched); + } + + // connect all resource entities with r2 with 1Mb/s connection + + // For each host, specify which PacketScheduler entity to use. + GridResource resObj = null; + for (int i = 0; i < resList.size(); i++) + { + FIFOScheduler resSched = new FIFOScheduler("GridResSched_"+i); + resObj = (GridResource) resList.get(i); + r2.attachHost(resObj, resSched); + } + + // then connect r1 to r2 with 10Mb/s connection + // For each host, specify which PacketScheduler entity to use. + baud_rate = 10000; + Link link = new SimpleLink("r1_r2_link", baud_rate, propDelay, mtu); + FIFOScheduler r1Sched = new FIFOScheduler("r1_Sched"); + FIFOScheduler r2Sched = new FIFOScheduler("r2_Sched"); + + // attach r2 to r1 + r1.attachRouter(r2, link, r1Sched, r2Sched); + + ////////////////////////////////////////// + // Starts the simulation + GridSim.startGridSimulation(); + + ////////////////////////////////////////// + // Final step: Prints the Gridlets when simulation is over + +// // also prints the routing table +// r1.printRoutingTable(); +// r2.printRoutingTable(); + } + catch(Exception ex){ + System.out.println(" Error executing simulation. Message: " + ex.getMessage()); + ex.printStackTrace(); + } + } + +} Added: trunk/examples/Auction/AuctionEx03/NetUser.java =================================================================== --- trunk/examples/Auction/AuctionEx03/NetUser.java (rev 0) +++ trunk/examples/Auction/AuctionEx03/NetUser.java 2008-05-27 07:55:44 UTC (rev 175) @@ -0,0 +1,164 @@ +/* + * Author: Marcos Dias de Assuncao + * Date: May 2008 + * Description: A simple program to demonstrate of how to use GridSim + * auction extension package. + * This example shows how to create user, resource, auctioneer + * and auction entities connected via a network topology, + * using link and router. + * + * This class was adapted from examples on network + * package developed by: Anthony Sulistio + * + */ + + +import eduni.simjava.Sim_event; +import eduni.simjava.Sim_system; +import eduni.simjava.distributions.ContinuousGenerator; +import eduni.simjava.distributions.Sim_uniform_obj; +import gridsim.GridSim; +import gridsim.GridSimTags; +import gridsim.Gridlet; +import gridsim.GridletList; +import gridsim.auction.AuctionTags; +import gridsim.auction.MessageBid; +import gridsim.net.SimpleLink; + +import java.util.Iterator; + + +/** + * This class basically creates Gridlets and submits them to a + * particular Broker in a network topology. + */ +class NetUser extends GridSim +{ + private int myId_; // my entity ID + private GridletList jobs; // list of jobs to be executed + private GridletList receiveJobs; // list of received Gridlets + private Broker broker; + private ContinuousGenerator priceGenerator; + private int secondsBetweenJobs = 60; + + /** + * Creates a new NetUser object + * @param name this entity name + * @param totalGridlet total number of Gridlets to be created + * @param baud_rate the baud rate of the link to which this user is attached + * @param delay the delay of the link + * @param MTU the maximum transfer unit of the link + * @param broker the broker associated with this user + * @throws Exception This happens when name is null or haven't + * initialized GridSim. + */ + NetUser(String name, int totalGridlet, double baud_rate, double delay, + int MTU, Broker broker) throws Exception { + super( name, new SimpleLink(name+"_link",baud_rate,delay, MTU) ); + + this.receiveJobs = new GridletList(); + this.jobs = new GridletList(); + this.broker = broker; + + // Gets an ID for this entity + this.myId_ = super.getEntityId(name); + + // Creates a list of Gridlets or Tasks for this grid user + this.createGridlet(myId_, totalGridlet); + long seed = 11L*13*17*19*23+1; + priceGenerator = new Sim_uniform_obj("price",1, 2, seed); + } + + /** + * The core method that handles communications among GridSim entities. + */ + public void body() { + // wait for a little while for about 10 seconds. + // This to give a time for GridResource entities to register their + // services to GIS (GridInformationService) entity. + super.gridSimHold(10.0); + double previous = 0; + + Iterator it = jobs.iterator(); + while(it.hasNext()) { + previous += secondsBetweenJobs; + + MessageBid bid = new MessageBid(0, AuctionTags.CONTINUOUS_DOUBLE_AUCTION, + 1, super.get_id()); + + bid.setPrice(priceGenerator.sample()); + bid.setAttribute("job", it.next()); + + super.send(broker.get_id(), + secondsBetweenJobs, + AuctionTags.AUCTION_PROPOSE, bid); + } + + // hold for few period - few seconds since the Gridlets length are + // quite huge for a small bandwidth + super.gridSimHold(5); + + Object data; + Gridlet gl; + + Sim_event ev = new Sim_event(); + while ( Sim_system.running() ) + { + super.sim_get_next(ev); // get the next available event + data = ev.get_data(); // get the event's data + + // get the Gridlet data + if (data != null && data instanceof Gridlet) + { + gl = (Gridlet) data; + receiveJobs.add(gl); + } + + // if all the Gridlets have been collected + if (receiveJobs.size() == jobs.size()) { + break; + } + } + + super.send(broker.get_id(), GridSimTags.SCHEDULE_NOW, + Broker.FINISHED_EXPERIMENTS); + + //////////////////////////////////////////////////////// + // shut down I/O ports + shutdownUserEntity(); + terminateIOEntities(); + + +// super.send(broker.get_id(), GridSimTags.SCHEDULE_NOW, +// GridSimTags.END_OF_SIMULATION); + } + + /** + * Gets a list of received Gridlets + * @return a list of received/completed Gridlets + */ + public GridletList getGridletList() { + return receiveJobs; + } + + /** + * This method will show you how to create Gridlets + * @param userID owner ID of a Gridlet + * @param numGridlet number of Gridlet to be created + */ + private void createGridlet(int userID, int numGridlet) + { + int data = 500; // 500KB of data + for (int i = 0; i < numGridlet; i++) + { + // Creates a Gridlet + Gridlet gl = new Gridlet(i, data, data, data); + gl.setUserID(userID); + + // add this gridlet into a list + this.jobs.add(gl); + } + } + +} // end class + Added: trunk/examples/Auction/AuctionEx03/README.txt =================================================================== --- trunk/examples/Auction/AuctionEx03/README.txt (rev 0) +++ trunk/examples/Auction/AuctionEx03/README.txt 2008-05-27 07:55:44 UTC (rev 175) @@ -0,0 +1,49 @@ + +/** + * Author: Anthony Sulistio + * Date: March 2006 + */ + + +Welcome to the Example of how to use GridSim auction extension. +To compile the example source code: + In Unix/Linux: javac -classpath $GRIDSIM/jars/gridsim.jar:. ExampleAuction.java + In Windows: javac -classpath %GRIDSIM%\jars\gridsim.jar;. ExampleAuction.java + +where $GRIDSIM or %GRIDSIM% is the location of the gridsimtoolkit package. + + +To run the class file: + In Unix/Linux: java -classpath $GRIDSIM/jars/gridsim.jar:. ExampleAuction > file.txt + In Windows: java -classpath %GRIDSIM%\jars\gridsim.jar;. ExampleAuction > file.txt + + +The above command means run the program and output the results into a file +named "file.txt" rather than into screen or standard output. +To prevent from overwriting an existing file, I renamed "file.txt" into +"output.txt" +NOTE: When you open "output.txt" file, it tells you that grid user entities + sending Gridlets to a selected grid resource. + + +When running the example file, it will produce the following files: + + sim_trace -> created by the SimJava2 package (lower-level) to trace every + events (performed by SimJava and GridSim) during the simulation. + We don't need to worry about this file. Not to important for our + example. + + sim_report -> created by the SimJava2 package (lower-level) of GridSim. + This is a simulation report that contains general information about + running this experiment. We don't need to worry about this file. + Not to important for our example. + + *.csv -> created by NetUser.java and gridsim.net.RIPRouter.java + to record every incoming activities. + The format of this file is: + simulation_time, ... + + where ... means other descriptive information. + +NOTE: sim_trace, sim_report and all *.csv files will be overwritten if running + a new experiment. Added: trunk/examples/Auction/AuctionEx03/ResponderImpl.java =================================================================== --- trunk/examples/Auction/AuctionEx03/ResponderImpl.java (rev 0) +++ trunk/examples/Auction/AuctionEx03/ResponderImpl.java 2008-05-27 07:55:44 UTC (rev 175) @@ -0,0 +1,87 @@ +/* + * Author: Marcos Dias de Assuncao + * Date: May 2008 + * Description: A simple program to demonstrate of how to use GridSim + * auction extension package. + * This example shows how to create user, resource, auctioneer + * and auction entities connected via a network topology, + * using link and router. + * + */ + +import gridsim.AllocPolicy; +import gridsim.ResourceCalendar; +import gridsim.ResourceCharacteristics; +import gridsim.auction.Message; +import gridsim.auction.MessageCallForBids; +import gridsim.auction.MessageInformOutcome; +import gridsim.auction.MessageInformStart; +import gridsim.auction.MessageRejectBid; +import gridsim.auction.Responder; + +/** + * This class implements a responder for an auction. + * + * @author Marcos Dias de Assuncao + * + */ +public class ResponderImpl implements Responder { + // this distribution is used to generate an + // internal price for the resource + private ResourceCharacteristics resource; + + /** + * Constructor (parameters are used just to ilustrate that the responder could + * take into account the usage of the resource or a give policy to formulate a bid + * @param resource + * @param calendar + * @param policy + * @throws Exception + */ + public ResponderImpl(ResourceCharacteristics resource, + ResourceCalendar calendar, + AllocPolicy policy) throws Exception{ + this.resource = resource; + } + + /** + * This method is invoked when a call for bids is received + * @param msg the call for bids received + * @return the reply message to the call for bids + * @see gridsim.auction.Responder#onReceiveCfb(MessageCallForBids) + */ + public Message onReceiveCfb(MessageCallForBids msg) { + return null; + } + + /** + * This method is invoked when an inform outcome message is received + * @param msg the inform outcome received + * @return the reply message to the inform outcome + * @see gridsim.auction.Responder#onReceiveInformOutcome(gridsim.auction.MessageInformOutcome) + */ + public Message onReceiveInformOutcome(MessageInformOutcome msg){ + return null; + } + + /** + * This method is invoked when a reject for proposal is received + * @param msg the reject proposal received + * @return the reply message to the reject proposal + * @see gridsim.auction.Responder#onReceiveRejectProposal(MessageRejectBid) + */ + public Message onReceiveRejectProposal(MessageRejectBid msg){ + return null; + } + + /** + * This method is invoked when an auction starts and an + * inform start message is received + * @param inform start received + * @return the reply message to the inform start + * @see gridsim.auction.Responder#onReceiveStartAuction(MessageInformStart) + */ + public Message onReceiveStartAuction(MessageInformStart inform){ + return null; + } +} \ No newline at end of file Added: trunk/examples/Auction/AuctionEx03/output.txt =================================================================== --- trunk/examples/Auction/AuctionEx03/output.txt (rev 0) +++ trunk/examples/Auction/AuctionEx03/output.txt 2008-05-27 07:55:44 UTC (rev 175) @@ -0,0 +1,106 @@ +Initializing GridSim package +Initialising... + +Starting to create one Grid resource with 3 Machines +Finally, creates one Grid resource (name: Resource_0 - id: 6) + + +Starting to create one Grid resource with 3 Machines +Finally, creates one Grid resource (name: Resource_1 - id: 12) + +User_0 creating a FPSA to acquire resource to execute job 0 from user 22 +User_0 creating an EA to acquire resource to execute job 1 from user 22 +User_0 creating a DA to acquire resource to execute job 2 from user 22 +User_1 creating a FPSA to acquire resource to execute job 0 from user 33 +User_1 creating an EA to acquire resource to execute job 1 from user 33 +User_1 creating a DA to acquire resource to execute job 2 from user 33 +User_2 creating a FPSA to acquire resource to execute job 0 from user 44 +User_2 creating an EA to acquire resource to execute job 1 from user 44 +User_2 creating a DA to acquire resource to execute job 2 from user 44 +Starting GridSim version 4.0 +Entities started. +Broker_0 starting the auction 0 to acquire resource to execute job 0 from user 22 +Broker_1 starting the auction 3 to acquire resource to execute job 0 from user 33 +Broker_2 starting the auction 6 to acquire resource to execute job 0 from user 44 +Broker_1 starting the auction 4 to acquire resource to execute job 1 from user 33 +Broker_2 starting the auction 7 to acquire resource to execute job 1 from user 44 +Broker_0 starting the auction 1 to acquire resource to execute job 1 from user 22 +Broker_2 starting the auction 8 to acquire resource to execute job 2 from user 44 +Broker_1 starting the auction 5 to acquire resource to execute job 2 from user 33 +Broker_0 starting the auction 2 to acquire resource to execute job 2 from user 22 +Resource_1 bidding for auction 2 round 2 and price 22.5 +Resource_0 bidding for auction 2 round 2 and price 22.5 +Resource_1 bidding for auction 5 round 2 and price 22.5 +Resource_0 bidding for auction 5 round 2 and price 22.5 +Resource_1 bidding for auction 8 round 2 and price 22.5 +Results of the auction +Winner ID: 12 +Price paid for executing the job 2: 22.5 +Submitted by user 22 +Resource_0 bidding for auction 8 round 2 and price 22.5 +Results of the auction +Winner ID: 12 +Price paid for executing the job 2: 22.5 +Submitted by user 33 +Results of the auction +Winner ID: 12 +Price paid for executing the job 2: 22.5 +Submitted by user 44 +Resource_1 bidding for auction 0 round 1 and price 7.62717866897583 +Resource_0 bidding for auction 0 round 1 and price 7.62717866897583 +Resource_1 bidding for auction 3 round 1 and price 7.017467021942139 +Resource_0 bidding for auction 3 round 1 and price 7.017467021942139 +Resource_1 bidding for auction 6 round 1 and price 2.2087604999542236 +Resource_0 bidding for auction 6 round 1 and price 2.2087604999542236 +Results of the auction +Winner ID: 12 +Price paid for executing the job 0: 7.62717866897583 +Submitted by user 22 +Results of the auction +Winner ID: 12 +Price paid for executing the job 0: 7.017467021942139 +Submitted by user 33 +Results of the auction +Winner ID: 12 +Price paid for executing the job 0: 2.2087604999542236 +Submitted by user 44 +Resource_1 bidding for auction 1 round 1 and price 90.0 +Resource_0 bidding for auction 1 round 1 and price 90.0 +Resource_1 bidding for auction 4 round 1 and price 90.0 +Resource_1 bidding for auction 7 round 1 and price 90.0 +Resource_0 bidding for auction 7 round 1 and price 90.0 +Resource_0 bidding for auction 4 round 1 and price 90.0 +Resource_1 bidding for auction 4 round 2 and price 67.5 +Resource_0 bidding for auction 1 round 2 and price 67.5 +Resource_1 bidding for auction 7 round 2 and price 67.5 +Resource_0 bidding for auction 4 round 2 and price 67.5 +Resource_1 bidding for auction 1 round 2 and price 67.5 +Resource_0 bidding for auction 7 round 2 and price 67.5 +Resource_1 bidding for auction 1 round 3 and price 45.0 +Resource_1 bidding for auction 4 round 3 and price 45.0 +Resource_0 bidding for auction 7 round 3 and price 45.0 +Resource_0 bidding for auction 1 round 3 and price 45.0 +Resource_1 bidding for auction 7 round 3 and price 45.0 +Resource_0 bidding for auction 4 round 3 and price 45.0 +Resource_1 bidding for auction 1 round 4 and price 22.5 +Resource_0 bidding for auction 1 round 4 and price 22.5 +Resource_1 bidding for auction 7 round 4 and price 22.5 +Resource_0 bidding for auction 7 round 4 and price 22.5 +Resource_1 bidding for auction 4 round 4 and price 22.5 +Resource_0 bidding for auction 4 round 4 and price 22.5 +Results of the auction +Winner ID: 12 +Price paid for executing the job 1: 22.5 +Submitted by user 22 +Results of the auction +Winner ID: 12 +Price paid for executing the job 1: 22.5 +Submitted by user 33 +Results of the auction +Winner ID: 12 +Price paid for executing the job 1: 22.5 +Submitted by user 44 +GridInformationService: Notify all GridSim entities for shutting down. +Sim_system: No more future events +Gathering simulation data. +Simulation completed. Modified: trunk/source/gridsim/auction/Auction.java =================================================================== --- trunk/source/gridsim/auction/Auction.java 2008-05-19 04:23:04 UTC (rev 174) +++ trunk/source/gridsim/auction/Auction.java 2008-05-27 07:55:44 UTC (rev 175) @@ -151,6 +151,19 @@ } /** + * Sets the auction's ID manually + * @param id the id to be used by the auction + * @return <tt>true</tt> if the ID has been set; <tt>false</tt> otherwise. + */ + public boolean setAuctionID(int id) { + if(id < 0) + return false; + + auctionID = id; + return true; + } + + /** * Returns the ID of this auction * @return auction ID */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |