SimGrid  3.16
Versatile Simulation of Distributed Systems
S4U: Next Generation SimGrid API

Detailed Description

Future core API, mixing the full power of SimGrid to the power of C++.

The S4U API is currently under heavy work, but will eventually deprecate the MSG and SimDag APIs. Everything that you can do in SimGrid will be possible in S4U.

S4U is not ready for public use yet. You should not go that path unless you know what you are doing. If unsure, proceed to MSG: Simulate CSP Algorithms instead.

Unsurprisingly, the S4U interface matches the concepts presented in the introduction. You should read this page first, to not get lost in the amount of classes provided here. Or you could jump to the S4U examples directly if you prefer.

Memory Management of S4U objects

For sake of simplicity, we use RAII everywhere in S4U. This is an idiom where resources are automatically managed through the context. Provided that you never manipulate objects of type Foo directly but always FooPtr references (which are boost::intrusive_ptr<Foo>), you will never have to explicitely release the resource that you use nor to free the memory of unused objects.

Here is a little example:

void myFunc()
simgrid::s4u::MutexPtr mutex = simgrid::s4u::Mutex::createMutex(); // Too bad we cannot use `new` here
mutex->lock(); // use the mutex as a simple reference
// bla bla
} // The mutex will get automatically freed because the only existing reference gets out of scope


class  simgrid::s4u::Actor
 An actor is an independent stream of execution in your distributed application. More...
class  simgrid::s4u::ConditionVariable
 A condition variableThis is a drop-in replacement of std::condition_variable and should respect the same semantic. More...
class  simgrid::s4u::Host
 An host represents some physical resource with computing and networking capabilities. More...
class  simgrid::s4u::Mailbox
 Mailboxes: Network rendez-vous points. More...
class  simgrid::s4u::Mutex
 A classical mutex, but blocking in the simulation worldIt is strictly impossible to use a real mutex, such as std::mutex or pthread_mutex_t, because it would block the whole simulation. More...
class  simgrid::s4u::VirtualMachine
 A VM is a virtual machine that contains actors. More...


 Static methods working on the current actor (see s4u::Actor)


 S4U examples
 Find the S4U example fitting your needs in the archive.