Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Ignore rules S1133 for Java too.
[simgrid.git] / examples / s4u / README.rst
1 .. S4U (Simgrid for you) is the next interface of SimGrid, expected to be released with SimGrid 4.0.
2 ..
3 .. Even if it is not completely rock stable yet, it may well already fit
4 .. your needs. You are welcome to try it and report any interface
5 .. glitches that you see. Be however warned that the interface may change
6 .. until the final release.  You will have to adapt your code on the way.
7 .. 
8 .. This file follows the ReStructured syntax to be included in the
9 .. documentation, but it should remain readable directly.
10
11
12 S4U Examples
13 ************
14
15 SimGrid comes with an extensive set of examples, documented on this
16 page. Most of them only demonstrate one single feature, with some
17 larger examplars listed below. 
18
19 The C++ examples can be found under examples/s4u while python examples
20 are in examples/python. Each such directory contains the source code (also listed
21 from this page), and the so-called tesh file containing how to call
22 the binary obtained by compiling this example and also the expected
23 output. Tesh files are used to turn each of our examples into an
24 integration test. Some examples also contain other files, on need.
25
26 A good way to bootstrap your own project is to copy and combine some
27 of the provided examples to constitute the skeleton of what you plan
28 to simulate.
29
30 ===========================
31 Actors: the Active Entities
32 ===========================
33
34 .. _s4u_ex_actors:
35
36 Starting and Stoping Actors
37 ---------------------------
38
39   - **Creating actors:**
40     Most actors are started from the deployment XML file, but there is other methods.
41     This example show them all.
42     `examples/python/actor-create/actor-create_d.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-create/actor-create_d.xml>`_
43     
44     - |cpp| `examples/s4u/actor-create/s4u-actor-create.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-create/s4u-actor-create.cpp>`_
45     - |py|  `examples/python/actor-create/actor-create.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-create/actor-create.py>`_
46
47   - **React to the end of actors:**
48     You can attach a callback to the end of actors. There is two ways
49     of doing so, depending of whether you want your callback to be
50     executed when a specific actor ends (with ```this_actor::on_exit()```)
51     or whether it should be executed when any actor ends (with
52     ```Actor::on_destruction()```)
53
54     - |cpp| `examples/s4u/actor-exiting/s4u-actor-exiting.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-exiting/s4u-actor-exiting.cpp>`_
55
56   - **Kill actors:**
57     Actors can forcefully stop other actors.
58     
59     - |cpp| `examples/s4u/actor-kill/s4u-actor-kill.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-kill/s4u-actor-kill.cpp>`_
60       :cpp:func:`void simgrid::s4u::Actor::kill(void)`,
61       :cpp:func:`void simgrid::s4u::Actor::kill_all()`,
62       :cpp:func:`simgrid::s4u::this_actor::exit`.
63     - |py| `examples/python/actor-kill/actor-kill.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-kill/actor-kill.py>`_
64       :py:func:`simgrid.Actor.kill`,
65       :py:func:`simgrid.Actor.kill_all`, 
66       :py:func:`simgrid.this_actor.exit`.
67
68   - **Controling the actor life cycle from the XML:**
69     You can specify a start time and a kill time in the deployment
70     file.
71     |br| `examples/s4u/actor-lifetime/s4u-actor-lifetime.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-lifetime/s4u-actor-lifetime.cpp>`_
72     |br| `examples/s4u/actor-lifetime/s4u-actor-lifetime_d.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-lifetime/s4u-actor-lifetime_d.xml>`_
73
74   - **Daemonize actors:**
75     Some actors may be intended to simulate daemons that run in background. This example show how to transform a regular
76     actor into a daemon that will be automatically killed once the simulation is over.
77     
78     - |cpp| `examples/s4u/actor-daemon/s4u-actor-daemon.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-daemon/s4u-actor-daemon.cpp>`_
79     - |py|  `examples/python/actor-daemon/actor-daemon.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-daemon/actor-daemon.py>`_
80     
81 Inter-Actors Interactions
82 -------------------------
83
84 See also the examples on :ref:`inter-actors communications
85 <s4u_ex_communication>` and the ones on :ref:`classical
86 synchronization objects <s4u_ex_IPC>`.
87
88   - **Suspend and Resume actors:**    
89     Actors can be suspended and resumed during their executions.
90     
91     - |cpp| `examples/s4u/actor-suspend/s4u-actor-suspend.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-suspend/s4u-actor-suspend.cpp>`_
92       :cpp:func:`simgrid::s4u::this_actor::suspend()`,
93       :cpp:func:`simgrid::s4u::Actor::suspend()`, :cpp:func:`simgrid::s4u::Actor::resume()`, :cpp:func:`simgrid::s4u::Actor::is_suspended()`.
94     - |py|  `examples/python/actor-suspend/actor-suspend.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-suspend/actor-suspend.py>`_
95       :py:func:`simgrid.this_actor.suspend()`,
96       :py:func:`simgrid.Actor.suspend()`, :py:func:`simgrid.Actor.resume()`, :py:func:`simgrid.Actor.is_suspended()`.
97
98   - **Migrating Actors:**
99     Actors can move or be moved from a host to another very easily.
100     
101     - |cpp| `examples/s4u/actor-migrate/s4u-actor-migrate.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-migrate/s4u-actor-migrate.cpp>`_
102       :cpp:func:`simgrid::s4u::this_actor::migrate()`
103     - |py|  `examples/python/actor-migrate/actor-migrate.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-migrate/actor-migrate.py>`_
104       :py:func:`simgrid.this_actor.migrate()`
105
106   - **Waiting for the termination of an actor:** (joining on it)
107     You can block the current actor until the end of another actor.
108     
109     - |cpp| `examples/s4u/actor-join/s4u-actor-join.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-join/s4u-actor-join.cpp>`_
110       :cpp:func:`simgrid::s4u::Actor::join()`
111     - |py|  `examples/python/actor-join/actor-join.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-join/actor-join.py>`_
112       :py:func:`simgrid.Actor.join()`
113
114   - **Yielding to other actors**.
115     The ```yield()``` function interrupts the execution of the current
116     actor, leaving a chance to the other actors that are ready to run
117     at this timestamp.
118     
119     - |cpp| `examples/s4u/actor-yield/s4u-actor-yield.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-yield/s4u-actor-yield.cpp>`_
120       :cpp:func:`simgrid::s4u::this_actor::yield()`
121     - |py|  `examples/python/actor-yield/actor-yield.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-yield/actor-yield.py>`_
122       :py:func:`simgrid.this_actor.yield_()`
123
124 Traces Replay as a Workload
125 ---------------------------
126
127 This section details how to run trace-driven simulations. It is very
128 handy when you want to test an algorithm or protocol that only react
129 to external events. For example, many P2P protocols react to user
130 requests, but do nothing if there is no such event.
131
132 In such situations, you should write your protocol in C++, and separate
133 the workload that you want to play onto your protocol in a separate
134 text file. Declare a function handling each type of the events in your
135 trace, register them using :cpp:func:`xbt_replay_action_register()` in
136 your main, and then run the simulation.
137
138 Then, you can either have one trace file containing all your events,
139 or a file per simulated process: the former may be easier to work
140 with, but the second is more efficient on very large traces. Check
141 also the tesh files in the example directories for details.
142
143   - **Communication replay:**
144     Presents a set of event handlers reproducing classical communication
145     primitives (asynchronous send/receive at the moment).
146     |br| `examples/s4u/replay-comm/s4u-replay-comm.cpp  <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/replay-comm/s4u-replay-comm.cpp>`_
147
148   - **I/O replay:**
149     Presents a set of event handlers reproducing classical I/O
150     primitives (open, read, close).
151     |br| `examples/s4u/replay-storage/s4u-replay-storage.cpp  <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/replay-storage/s4u-replay-storage.cpp>`_
152
153 ==========================
154 Activities: what Actors do
155 ==========================
156
157 .. _s4u_ex_communication:
158
159 Communications on the Network
160 -----------------------------
161
162  - **Basic asynchronous communications:**
163    Illustrates how to have non-blocking communications, that are
164    communications running in the background leaving the process free
165    to do something else during their completion. 
166    
167    - |cpp| `examples/s4u/async-wait/s4u-async-wait.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/async-wait/s4u-async-wait.cpp>`_
168      :cpp:func:`simgrid::s4u::Mailbox::put_async()` and :cpp:func:`simgrid::s4u::Comm::wait()`
169    - |py|  `examples/python/async-wait/async-wait.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/async-wait/async-wait.py>`_
170      :py:func:`simgrid.Mailbox.put_async()` :py:func:`simgrid.Comm.wait()`
171
172  - **Waiting for all communications in a set:**
173    The `wait_all()` function is useful when you want to block until
174    all activities in a given set have completed. 
175    
176    - |cpp| `examples/s4u/async-waitall/s4u-async-waitall.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/async-waitall/s4u-async-waitall.cpp>`_
177      :cpp:func:`simgrid::s4u::Comm::wait_all()`
178    - |py| `examples/python/async-waitall/async-waitall.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/async-waitall/async-waitall.py>`_
179      :py:func:`simgrid.Comm.wait_all()`
180
181  - **Waiting for the first completed communication in a set:**
182    The `wait_any()` function is useful
183    when you want to block until one activity of the set completes, no
184    matter which terminates first.
185    
186    - |cpp| `examples/s4u/async-waitany/s4u-async-waitany.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/async-waitany/s4u-async-waitany.cpp>`_
187      :cpp:func:`simgrid::s4u::Comm::wait_any()`
188    - |py| `examples/python/async-waitany/async-waitany.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/async-waitany/async-waitany.py>`_
189      :py:func:`simgrid.Comm.wait_any()`
190      
191 .. todo:: review the `ready` and `waituntil` examples and add them here.
192    
193 .. _s4u_ex_execution:
194
195 Executions on the CPU
196 ---------------------
197
198   - **Basic execution:**
199     The computations done in your program are not reported to the
200     simulated world, unless you explicitely request the simulator to pause
201     the actor until a given amount of flops gets computed on its simulated
202     host. Some executions can be given an higher priority so that they
203     get more resources.
204     
205     - |cpp| `examples/s4u/exec-basic/s4u-exec-basic.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-basic/s4u-exec-basic.cpp>`_
206     - |py|  `examples/python/exec-basic/exec-basic.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/exec-basic/exec-basic.py>`_
207
208   - **Asynchronous execution:**
209     You can start asynchronous executions, just like you would fire
210     background threads.
211     
212     - |cpp| `examples/s4u/exec-async/s4u-exec-async.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-async/s4u-exec-async.cpp>`_
213     - |py|  `examples/python/exec-async/exec-async.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/exec-async/exec-async.py>`_
214     
215   - **Remote execution:**
216     You can start executions on remote hosts, or even change the host
217     on which they occur during their execution.
218     
219     - |cpp| `examples/s4u/exec-remote/s4u-exec-remote.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-remote/s4u-exec-remote.cpp>`_
220     - |py| `examples/python/exec-remote/exec-remote.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/exec-remote/exec-remote.py>`_
221
222   - **Parallel executions:**
223     These objects are convenient abstractions of parallel
224     computational kernels that span over several machines, such as a
225     PDGEM and the other ScaLAPACK routines. Note that this only works
226     with the "ptask_L07" host model (``--cfg=host/model:ptask_L07``).
227     |br| `examples/s4u/exec-ptask/s4u-exec-ptask.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-ptask/s4u-exec-ptask.cpp>`_
228     
229   - **Using Pstates on a host:**
230     `examples/platforms/energy_platform.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/energy_platform.xml>`_
231     shows how define a set of pstates in the XML. The current pstate
232     of an host can then be accessed and changed from the program.
233
234     - |cpp| `examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp>`_
235       :cpp:func:`simgrid::s4u::Host::get_pstate_speed` and :cpp:func:`simgrid::s4u::Host::set_pstate`.
236     - |py|  `examples/python/exec-dvfs/exec-dvfs.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/exec-dvfs/exec-dvfs.py>`_
237       :py:func:`Host.get_pstate_speed` and :py:func:`Host.set_pstate`.
238
239 I/O on Disks and Files
240 ----------------------
241
242 SimGrid provides two levels of abstraction to interact with the
243 simulated storages. At the simplest level, you simply create read and
244 write actions on the storage resources.
245
246   - **Access to raw storage devices:**
247     This example illustrates how to simply read and write data on a
248     simulated storage resource.
249     |br| `examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp  <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp>`_
250
251 The FileSystem plugin provides a more detailed view, with the
252 classical operations over files: open, move, unlink, and of course
253 read and write. The file and disk sizes are also dealt with and can
254 result in short reads and short write, as in reality.
255
256   - **File Management:**
257     This example illustrates the use of operations on files
258     (read, write, seek, tell, unlink, etc).
259     |br| `examples/s4u/io-file-system/s4u-io-file-system.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/io-file-system/s4u-io-file-system.cpp>`_
260
261   - **Remote I/O:**
262     I/O operations on files can also be done in a remote fashion, 
263     i.e. when the accessed disk is not mounted on the caller's host.
264     |br| `examples/s4u/io-file-remote/s4u-io-file-remote.cpp  <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/io-file-remote/s4u-io-file-remote.cpp>`_
265
266 .. _s4u_ex_IPC:
267
268 Classical synchronization objects
269 ---------------------------------
270
271  - **Mutex:**
272    Shows how to use simgrid::s4u::Mutex synchronization objects.
273    |br| `examples/s4u/synchro-mutex/s4u-synchro-mutex.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/synchro-mutex/s4u-synchro-mutex.cpp>`_
274
275  - **Barrier:**
276    Shows how to use simgrid::s4u::Barrier synchronization objects.
277    |br| `examples/s4u/synchro-barrier/s4u-synchro-barrier.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/synchro-barrier/s4u-synchro-barrier.cpp>`_
278
279  - **Semaphore:**
280    Shows how to use simgrid::s4u::Semaphore synchronization objects.
281    |br| `examples/s4u/synchro-semaphore/s4u-synchro-semaphore.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/synchro-semaphore/s4u-synchro-semaphore.cpp>`_
282
283 =============================
284 Interacting with the Platform
285 =============================
286
287  - **Retrieving the list of hosts matching a given criteria:**
288    Shows how to filter the actors that match a given criteria.
289    |br| `examples/s4u/engine-filtering/s4u-engine-filtering.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/engine-filtering/s4u-engine-filtering.cpp>`_
290
291  - **User-defined properties:**
292    You can attach arbitrary information to most platform elements from
293    the XML file, and then interact with these values from your
294    program. Note that the changes are not written permanently on disk,
295    in the XML file nor anywhere else. They only last until the end of
296    your simulation.
297    
298    - :cpp:func:`simgrid::s4u::Actor::get_property()` and :cpp:func:`simgrid::s4u::Actor::set_property()`
299    - :cpp:func:`simgrid::s4u::Host::get_property()` and :cpp:func:`simgrid::s4u::Host::set_property()`
300    - :cpp:func:`simgrid::s4u::Link::get_property()` and :cpp:func:`simgrid::s4u::Link::set_property()`
301    - :cpp:func:`simgrid::s4u::NetZone::get_property()` and :cpp:func:`simgrid::s4u::NetZone::set_property()`
302      
303    |br| `examples/s4u/platform-properties/s4u-platform-properties.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/platform-properties/s4u-platform-properties.cpp>`_
304    |br| `examples/s4u/platform-properties/s4u-platform-properties_d.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/platform-properties/s4u-platform-properties_d.xml>`_
305    |br| `examples/platforms/prop.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/prop.xml>`_
306
307  - **Specifying state profiles:** shows how to specify when the
308    resources must be turned off and on again, and how to react to such
309    failures in your code.
310    
311    |br| `examples/platforms/small_platform_failures.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/small_platform_failures.xml>`_
312    |br| The state profiles in `examples/platforms/profiles <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/profiles>`_
313
314  - **Specifying speed profiles:** shows how to specify an external
315    load to resources, variating their peak speed over time.
316    
317    |br| `examples/platforms/small_platform_profile.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/small_platform_profile.xml>`_
318    |br| The speed, bandwidth and latency profiles in `examples/platforms/profiles  <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/profiles>`_
319
320 =================
321 Energy Simulation
322 =================
323
324   - **Describing the energy profiles in the platform:**
325     This platform file contains the energy profile of each links and
326     hosts, which is necessary to get energy consumption predictions.
327     As usual, you should not trust our example, and you should strive
328     to double-check that your instanciation matches your target platform.
329     |br| `examples/platforms/energy_platform.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/energy_platform.xml>`_
330
331   - **Consumption due to the CPU:** 
332     This example shows how to retrieve the amount of energy consumed
333     by the CPU during computations, and the impact of the pstate.
334     |br| `examples/s4u/energy-exec/s4u-energy-exec.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/energy-exec/s4u-energy-exec.cpp>`_
335
336   - **Consumption due to the network:**
337     This example shows how to retrieve and display the energy consumed
338     by the network during communications.
339     |br| `examples/s4u/energy-link/s4u-energy-link.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/energy-link/s4u-energy-link.cpp>`_
340
341   - **Modeling the shutdown and boot of hosts:**
342     Simple example of model of model for the energy consumption during
343     the host boot and shutdown periods.
344     |br| `examples/s4u/energy-boot/platform_boot.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/energy-boot/platform_boot.xml>`_
345     |br| `examples/s4u/energy-boot/s4u-energy-boot.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/energy-boot/s4u-energy-boot.cpp>`_
346
347 =======================
348 Tracing and Visualizing
349 =======================
350
351 Tracing can be activated by various configuration options which
352 are illustrated in these example. See also the 
353 :ref:`full list of options related to tracing <tracing_tracing_options>`.
354
355 It is interesting to run the process-create example with the following
356 options to see the task executions:
357
358   - **Platform Tracing:**
359     This program is a toy example just loading the platform, so that
360     you can play with the platform visualization. Recommanded options:
361     ``--cfg=tracing:yes --cfg=tracing/categorized:yes``
362     |br| `examples/s4u/trace-platform/s4u-trace-platform.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/trace-platform/s4u-trace-platform.cpp>`_
363
364 ========================
365 Larger SimGrid Examplars
366 ========================
367
368 This section contains application examples that are somewhat larger
369 than the previous examples.
370
371   - **Ping Pong:**
372     This simple example just sends one message back and forth.
373     The tesh file laying in the directory show how to start the simulator binary, highlighting how to pass options to 
374     the simulators (as detailed in Section :ref:`options`). 
375     |br| `examples/s4u/app-pingpong/s4u-app-pingpong.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/app-pingpong/s4u-app-pingpong.cpp>`_
376
377   - **Token ring:**
378     Shows how to implement a classical communication pattern, where a
379     token is exchanged along a ring to reach every participant.
380     |br| `examples/s4u/app-token-ring/s4u-app-token-ring.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/app-token-ring/s4u-app-token-ring.cpp>`_
381
382   - **Master Workers:**
383     Another good old example, where one Master process has a bunch of task to dispatch to a set of several Worker 
384     processes. This example comes in two equivalent variants, one
385     where the actors are specified as simple functions (which is easier to
386     understand for newcomers) and one where the actors are specified
387     as classes (which is more powerful for the users wanting to build
388     their own projects upon the example).
389     |br| `examples/s4u/app-masterworkers/s4u-app-masterworkers-class.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/app-masterworkers/s4u-app-masterworkers-class.cpp>`_
390     |br| `examples/s4u/app-masterworkers/s4u-app-masterworkers-fun.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/app-masterworkers/s4u-app-masterworkers-fun.cpp>`_
391     
392 Data diffusion
393 --------------
394
395   - **Bit Torrent:** 
396     Classical protocol for Peer-to-Peer data diffusion.
397     |br| `examples/s4u/app-bittorrent/s4u-bittorrent.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/app-bittorrent/s4u-bittorrent.cpp>`_
398     
399   - **Chained Send:** 
400     Data broadcast over a ring of processes.
401     |br| `examples/s4u/app-chainsend/s4u-app-chainsend.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/app-chainsend/s4u-app-chainsend.cpp>`_
402
403 Distributed Hash Tables (DHT)
404 -----------------------------
405
406   - **Chord Protocol** 
407     One of the most famous DHT protocol.
408     |br| `examples/s4u/dht-chord/s4u-dht-chord.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/dht-chord/s4u-dht-chord.cpp>`_
409
410 .. _s4u_ex_clouds:
411
412 Simulating Clouds
413 -----------------
414
415   - **Cloud basics**
416     This example starts some computations both on PMs and VMs, and
417     migrates some VMs around.
418     |br| `examples/s4u/cloud-simple/s4u-cloud-simple.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/cloud-simple/s4u-cloud-simple.cpp>`_
419
420 .. TODO:: document here the examples about clouds and plugins
421
422 =======================
423 Model-Checking Examples
424 =======================
425
426 The model-checker can be used to exhaustively search for issues in the
427 tested application. It must be activated at compile time, but this
428 mode is rather experimental in SimGrid (as of v3.22). You should not
429 enable it unless you really want to formally verify your applications:
430 SimGrid is slower and maybe less robust when MC is enabled.
431
432   - **Failing assert**
433     In this example, two actors send some data to a central server,
434     which asserts that the messages are always received in the same order.
435     This is obviously wrong, and the model-checker correctly finds a
436     counter-example to that assertion.
437     |br| `examples/s4u/mc-failing-assert/s4u-mc-failing-assert.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/mc-failing-assert/s4u-mc-failing-assert.cpp>`_
438
439 .. |br| raw:: html
440
441    <br />
442
443 .. |cpp| image:: /img/lang_cpp.png
444    :align: middle
445    :width: 12
446
447 .. |py| image:: /img/lang_python.png
448    :align: middle
449    :width: 12