Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
new doc: how to model hosts shutdown
[simgrid.git] / doc / doxygen / howtos.doc
1 /** @page howto Use Cases and Howtos
2
3 @tableofcontents
4
5 There is no perfect model, but only models that are adapted to the
6 specific study that you want to do. SimGrid provide several advanced
7 mechanisms that you can adapt to model the situation that you are
8 interested into, and it is often uneasy to see where to start with.
9
10 This page collects several hints and tricks on modeling situations.
11 Most probably, the exact situation that you want to model will not be
12 described here (unless we already [scooped
13 you](http://www.phdcomics.com/comics/archive.php?comicid=789)), but we
14 hope you will find some ideas and see how to use the modeling options
15 that SimGrid provides.
16
17 Of course, you should also check the @ref examples page, that shows
18 more detailed usage examples. As for the rest of the documentation
19 (and of SimGrid, actually), any contribution is welcome.
20
21
22 @section howto_bootenergy Modeling machine bootup and shutdown periods
23
24 When a physical host boots up, a lot of things happen. It takes time
25 during which the machine is not usable but dissipates energy, and
26 programs actually die and restart during a reboot. Since there is many
27 ways to model it, SimGrid does not do any modeling choice for you but
28 the most obvious ones.
29
30 Any actor (or process in MSG) running on an host that is shut down
31 will be killed and all its activities (tasks in MSG) will be
32 automatically canceled. If killed the actor was marked as
33 auto-restartable (with simgrid::s4u::Actor::setAutoRestart() or with
34 MSG_process_auto_restart_set()), it will start anew with the same
35 parameters when the host boots back up.
36
37 By default, shutdowns and bootups are instantaneous. If you want to
38 add an extra delay, you have to do that yourself, for example from an
39 /controler/ actor that runs on another host. The best way to do so is
40 to declare a fictionous pstate where the CPU delivers 0 flop per
41 second (so every activity on that host will be frozen when the host is
42 in this pstate). When you want to switch the host off, your controler
43 switches the host to that specific pstate (with
44 simgrid::s4u::Host::setPstate()), waits for the amount of time that
45 you decided necessary for your host to shut down, and turns the host
46 off (with simgrid::s4u::Host::turnOff()). To boot up, switch the host
47 on, go into the specific pstate, wait a while and go to a more regular
48 pstate.
49
50 To model the energy dissipation, you need to put the right energy
51 consumption in your startup/shutdown specific pstate. Remember that
52 the energy consumed is equal to the instantaneous consumption
53 multiplied by the time in which the host keeps in that state. Do the
54 maths, and set the right instantaneous consumption to your pstate, and
55 you'll get the whole boot period to consume the amount of energy that
56 you want. You may want to have one fictionous pstate for the bootup
57 period and another one for the shutdown period.
58
59 Of course, this is only one possible way to model these things. YMMV ;)
60
61 */