SimGrid  3.18
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 near from its final state. Everything that you can do in SimGrid should be possible in S4U and the missing pieces are seen as bugs.

Warning
S4U is still evolving: v3.18 is a beta release. You are really welcome to test it, but this API may change between releases. This is however the way to go if you want to create a new long-term project. If you want to play safe, proceed to deprecated MSG: Legacy handling of 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
mutex->unlock();
} // The mutex will get automatically freed because the only existing reference gets out of scope

Classes

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::Semaphore
 A classical semaphore, but blocking in the simulation worldIt is strictly impossible to use a real semaphore, such as sem_init, because it would block the whole simulation. More...
 
class  simgrid::s4u::VirtualMachine
 A VM represents a virtual machine (or a container) that hosts actors. More...
 

Namespaces

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

Modules

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