SlideShare a Scribd company logo
What is SObjectizer-5.6?
(at version 5.6.0)
SObjectizer Team, May 2019
SObjectizer is a framework for building robust multithreaded
applications.
It is based on async message exchange and uses a mixture of
high-level abstractions:
● Actor-Model
● Publish-Subscribe
● Communicating Sequential Processes
SObjectizer Team, May 2019
SObjectizer’s main ideas and principles were formulated in the
middle of 1990s, during the development of SCADA Objectizer
project in Development Bureau of System Programming in
Homyel, Belarus (1996-2000).
SCADA Objectizer’s ideas were reused in the new project
SObjectizer-4 in 2002.
Evolution of SObjectizer-4 was stopped in 2010 and the
development of SObjectizer-5 started.
SObjectizer Team, May 2019
SObjectizer was an in-house project of Intervale*
for the long
time.
Since 2013 SObjectizer is an independent project which a
totally separated from Intervale.
Since 2016 the SObjectizer's development and support is
performed by stiffstream**
.
*
www.intervale.ru
**
stiffstream.com SObjectizer Team, May 2019
SObjectizer was used for:
● SMS/USSD traffic service;
● financial transaction handling;
● software parameters monitoring;
● automatic control of the theatre's scenery*
;
● machine learning;
● prototyping of distributed data-acquisition software;
● components of DMP in an advertising platform;
● components of an online game.
SObjectizer Team, May 2019*
https://habr.com/en/post/452464/
SObjectizer can be used for the development of a large,
distributed and highly loaded software systems.
SObjectizer can also be used for small utilities and
quick-and-dirty prototypes.
The whole application can be built upon SObjectizer.
Or SObjectizer can be used only for a small part of an
application developed on the top of Qt, wxWidgets, ACE, Boost,
etc.
SObjectizer Team, May 2019
What distinguishes SObjectizer?
SObjectizer Team, May 2019
Maturity
SObjectizer is based on ideas that have been put forward in
1995-2000.
And SObjectizer itself is being developed since 2002.
SObjectizer-5 is continuously evolved since 2010.
SObjectizer Team, May 2019
Stability
From the very beginning SObjectizer was used for
business-critical applications, and some of them are still being
used in production.
Breaking changes in SObjectizer are rare and we approach to
them very carefully.
For example, branch 5.5 respects compatibility for more that
four years.
SObjectizer Team, May 2019
Cross-platform
SObjectizer runs on Windows, Linux, FreeBSD, macOS and
Android.
SObjectizer Team, May 2019
Easy-to-use
SObjectizer provides easy to understand and easy to use API
with a lot of examples in the SObjectizer's distributive and a
plenty of information in the project's Wiki*
.
SObjectizer Team, May 2019*
https://bitbucket.org/sobjectizerteam/sobjectizer/wiki/
Free
SObjectizer is distributed under BSD-3-CLAUSE license, so it
can be used in development of proprietary commercial software
for free.
SObjectizer Team, May 2019
It's not dead!
SObjectizer is one of a few live and evolving OpenSource actor
frameworks for C++.
There are more that 30 releases on SObjectizer-5 since it was
open-sourced in May 2013.
SObjectizer Team, May 2019
It evolves
SObjectizer-5.6 has much more features than the first public
release of SObjectizer-5 had in 2013.
During the evolution, SObjectizer incorporated several features
that can be called game-changers...
SObjectizer Team, May 2019
Some of new features since 2013:
● agents as hierarchical state machines;
● mutability for messages;
● message chains;
● environment infrastructures;
● enveloped messages;
● dead-letter handlers;
● message-tracing;
● stop-guards;
● run-time monitoring;
● ...
SObjectizer Team, May 2019
Let's dig into some details!
SObjectizer Team, May 2019
Using SObjectizer-5.6 a programmer must define
messages/signals and implement agents for processing them.
Agents are created by the programmer and are bound to
dispatchers. Dispatchers are responsible for message
dispatching and providing of working thread on which agents
handle messages.
SObjectizer Team, May 2019
A programmer can create as many agents as needed.
Agent is a lightweight entity.
There could be thousands, millions and hundreds of millions of
agents.
Number of agents is limited only by amount of RAM and the
common sense of a programmer.
SObjectizer Team, May 2019
A traditional "Hello, World" example. This is the main agent:
#include <so_5/all.hpp>
class hello_actor final : public so_5::agent_t {
public:
using so_5::agent_t::agent_t;
void so_evt_start() override {
std::cout << "Hello, World!" << std::endl;
// Finish work of example.
so_deregister_agent_coop_normally();
}
};
SObjectizer Team, May 2019
And this is the main() function:
int main() {
// Launch SObjectizer.
so_5::launch([](so_5::environment_t & env) {
// Add a hello_actor instance in a new cooperation.
env.register_agent_as_coop( env.make_agent<hello_actor>() );
});
return 0;
}
SObjectizer Team, May 2019
Let's see an example of timers and Publish/Subscribe.
There will be a producer agent that will distribute new values on a
periodic basis.
And there will be a couple of consumers on that data.
SObjectizer Team, May 2019
Define a message with new data:
#include <so_5/all.hpp>
using namespace std::literals;
// This message will be published to a multi-consumer message box on a periodic basis.
struct acquired_value {
std::chrono::steady_clock::time_point acquired_at_;
int value_;
};
SObjectizer Team, May 2019
Agent-producer (fields and the constructor):
class producer final : public so_5::agent_t {
const so_5::mbox_t board_; // The destination for acquired_value.
so_5::timer_id_t timer_;
int counter_{};
// This signal will be sent by the timer.
struct acquisition_time final : public so_5::signal_t {};
public:
producer(context_t ctx, so_5::mbox_t board)
: so_5::agent_t{std::move(ctx)}, board_{std::move(board)}
{}
SObjectizer Team, May 2019
Agent-producer (the main methods):
void so_define_agent() override {
// A subscription to periodic signal.
so_subscribe_self().event( [this](mhood_t<acquisition_time>) {
// Publish the next value for all consumers.
so_5::send<acquired_value>(
board_, std::chrono::steady_clock::now(), ++counter_);
} );
}
void so_evt_start() override {
// Agent will periodically recive acquisition_time signal
// without initial delay and with period of 750ms.
timer_ = so_5::send_periodic<acquisition_time>(*this, 0ms, 750ms);
}
};
SObjectizer Team, May 2019
Agent-consumer:
class consumer final : public so_5::agent_t {
const so_5::mbox_t board_;
const std::string name_;
void on_value(mhood_t<acquired_value> cmd) {
std::cout << name_ << ": " << cmd->value_ << std::endl;
}
public:
consumer(context_t ctx, so_5::mbox_t board, std::string name)
: so_5::agent_t{std::move(ctx)}, board_{std::move(board)}, name_{std::move(name)}
{}
void so_define_agent() override { so_subscribe(board_).event(&consumer::on_value); }
};
SObjectizer Team, May 2019
The main() function:
int main() {
so_5::launch([](so_5::environment_t & env) {
auto board = env.create_mbox();
env.introduce_coop([board](so_5::coop_t & coop) {
coop.make_agent<producer>(board);
coop.make_agent<consumer>(board, "first"s);
coop.make_agent<consumer>(board, "second"s);
});
std::this_thread::sleep_for(4s);
env.stop();
});
return 0;
}
SObjectizer Team, May 2019
All agents in the example above works on the same default
dispatcher.
Let's bind them to different dispatchers...
SObjectizer Team, May 2019
so_5::launch([](so_5::environment_t & env) {
auto board = env.create_mbox();
env.introduce_coop([&](so_5::coop_t & coop) {
// A separate dispatcher for producer.
coop.make_agent_with_binder<producer>(
so_5::disp::one_thread::make_dispatcher(env).binder(), board);
// And a separate dispatcher for consumers.
auto disp = so_5::disp::active_obj::make_dispatcher(env);
coop.make_agent_with_binder<consumer>(disp.binder(), board, "first"s);
coop.make_agent_with_binder<consumer>(disp.binder(), board, "second"s);
});
...
});
SObjectizer Team, May 2019
SObjectizer has several ready-to-use dispatchers:
● one_thread. All agents work on a single working thread;
● active_obj. Every agent works on a single dedicated working thread;
● active_group. A single dedicated working thread is allocated for a group of
agents;
● thread_pool. A working thread is selected from thread pool. Agents can be moved
from one working thread to another. But an agent can’t work on two threads at the
same time;
● adv_thread_pool. A working thread is selected from thread pool. Agents can be
moved from one working thread to another. Moreover an agent can work on
several threads at the same time (if the agent’s event handlers are marked as
thread safe);
● prio_one_thread (strictly_ordered and quoted_round_robin). One working
thread and dispatching with respect to agent’s priorities;
● prio_dedicated_threads::one_per_prio. One working thread per a priority.
SObjectizer Team, May 2019
A programmer can create any number of dispatchers needed. This
allows to bind agents to different context in such a way that the impact
of one agent on another will be minimal. For example:
● one one_thread dispatcher for AMQP-client agent;
● one thread_pool dispatcher for handling requests from AMQP-queues;
● one active_obj dispatcher for DBMS-related agents;
● yet another active_obj dispatcher for agents whose work with HSMs
connected to the computer;
● and yet another thread_pool dispatcher for agents for managing all the
stuff described above.
SObjectizer Team, May 2019
SObjectizer even allows writing an application without actors...
SObjectizer Team, May 2019
You can write a multithreaded application using only plain
std::thread and SObjectizer's mchains.
mchain in SObjectizer is an analog of CSP-channel.
Let's see a ping-pong between worker threads via mchains...
SObjectizer Team, May 2019
Ping-pong on plain threads and mchains (1)
#include <so_5/all.hpp>
struct ping {
int counter_;
};
struct pong {
int counter_;
};
SObjectizer Team, May 2019
Ping-pong on plain threads and mchains (2)
void pinger_proc(so_5::mchain_t self_ch, so_5::mchain_t ping_ch) {
so_5::send<ping>(ping_ch, 1000); // The initial "ping".
// Read all message until channel will be closed.
so_5::receive( so_5::from(self_ch).handle_all(),
[&](so_5::mhood_t<pong> cmd) {
if(cmd->counter_ > 0)
so_5::send<ping>(ping_ch, cmd->counter_ - 1);
else {
// Channels have to be closed to break `receive` calls.
so_5::close_drop_content(self_ch);
so_5::close_drop_content(ping_ch);
}
});
}
SObjectizer Team, May 2019
Ping-pong on plain threads and mchains (3)
void ponger_proc(so_5::mchain_t self_ch, so_5::mchain_t pong_ch) {
int pings_received{};
// Read all message until channel will be closed.
so_5::receive( so_5::from(self_ch).handle_all(),
[&](so_5::mhood_t<ping> cmd) {
++pings_received;
so_5::send<pong>(pong_ch, cmd->counter_);
});
std::cout << "pings received: " << pings_received << std::endl;
}
SObjectizer Team, May 2019
Ping-pong on plain threads and mchains (4)
int main() {
so_5::wrapped_env_t sobj;
auto pinger_ch = so_5::create_mchain(sobj);
auto ponger_ch = so_5::create_mchain(sobj);
std::thread pinger{pinger_proc, pinger_ch, ponger_ch};
std::thread ponger{ponger_proc, ponger_ch, pinger_ch};
ponger.join();
pinger.join();
return 0;
}
SObjectizer Team, May 2019
SObjectizer is not a silver bullet
SObjectizer Team, May 2019
SObjectizer supports several concurrency models.
SObjectizer makes the development of complex multithreaded
applications easier.
It's proved by 17 years of usage "in production".
But SObjectizer doesn't solve all the problems...
SObjectizer Team, May 2019
SObjectizer is responsible for:
● in-process message dispatching;
● providing working thread for message processing;
● SObjectizer Run-Time’s parameters tuning;
● collecting of run-time stats (if enabled);
● message delivery process tracing (if enabled).
SObjectizer Team, May 2019
And SObjectizer-5 doesn't support development of distributed
application just "out of box".
Additional libraries and tools should be used for that.
SObjectizer Team, May 2019
Some more info about
SObjectizer-5.6.0
SObjectizer Team, May 2019
SObjectizer-5.6 is developed using C++17.
Supported compilers and platforms:
● Visual Studio 2017-2019, GCC 7.1-9.1, clang 6.0-8.0
● Windows, Linux, FreeBSD and MacOS.
Support of other platforms is possible in the case when
SObjectizer’s developers will have an access to those platforms.
SObjectizer Team, May 2019
Version 5.6.0 is ~30 KLOC of SObjectizer core.
Plus ~35 KLOC of tests.
Plus ~8 KLOC of samples.
Plus SObjectizer’s core documentation*.
Plus articles and presentations** (some of them in Russian).
*
https://bitbucket.org/sobjectizerteam/sobjectizer/wiki
**
http://sourceforge.net/p/sobjectizer/wiki/Articles/ SObjectizer Team, May 2019
Useful references:
Project’s home: https://bitbucket.org/sobjectizerteam/sobjectizer
Documentation: https://bitbucket.org/sobjectizerteam/sobjectizer/wiki
Google-group: https://groups.google.com/forum/#!forum/sobjectizer
Support: https://stiffstream.com

More Related Content

Similar to What is SObjectizer 5.6 (at v.5.6.0)

What is SObjectizer 5.7 (at v.5.7.0)
What is SObjectizer 5.7 (at v.5.7.0)What is SObjectizer 5.7 (at v.5.7.0)
What is SObjectizer 5.7 (at v.5.7.0)
Yauheni Akhotnikau
 
What is SObjectizer 5.5
What is SObjectizer 5.5What is SObjectizer 5.5
What is SObjectizer 5.5
Yauheni Akhotnikau
 
Dive into SObjectizer 5.5. Eighth Part: Dispatchers
Dive into SObjectizer 5.5. Eighth Part: DispatchersDive into SObjectizer 5.5. Eighth Part: Dispatchers
Dive into SObjectizer 5.5. Eighth Part: Dispatchers
Yauheni Akhotnikau
 
Dive into SObjectizer 5.5. Introductory part
Dive into SObjectizer 5.5. Introductory partDive into SObjectizer 5.5. Introductory part
Dive into SObjectizer 5.5. Introductory part
Yauheni Akhotnikau
 
ROS Based Programming and Visualization of Quadrotor Helicopters
ROS Based Programming and Visualization of Quadrotor HelicoptersROS Based Programming and Visualization of Quadrotor Helicopters
ROS Based Programming and Visualization of Quadrotor Helicopters
Atılay Mayadağ
 
What's new in SObjectizer 5.5.9
What's new in SObjectizer 5.5.9What's new in SObjectizer 5.5.9
What's new in SObjectizer 5.5.9
Yauheni Akhotnikau
 
Get started with meteor | designveloper software agency meteor prime partner
Get started with meteor | designveloper software agency   meteor prime partnerGet started with meteor | designveloper software agency   meteor prime partner
Get started with meteor | designveloper software agency meteor prime partner
Designveloper
 
Basic iOS Training with SWIFT - Part 1
Basic iOS Training with SWIFT - Part 1Basic iOS Training with SWIFT - Part 1
Basic iOS Training with SWIFT - Part 1
Manoj Ellappan
 
IRJET- Build a Secure Web based Code Editor for C Programming Language
IRJET-  	  Build a Secure Web based Code Editor for C Programming LanguageIRJET-  	  Build a Secure Web based Code Editor for C Programming Language
IRJET- Build a Secure Web based Code Editor for C Programming Language
IRJET Journal
 
Spring boot
Spring bootSpring boot
Dive into SObjectizer 5.5. Seventh part: Message Limits
Dive into SObjectizer 5.5. Seventh part: Message LimitsDive into SObjectizer 5.5. Seventh part: Message Limits
Dive into SObjectizer 5.5. Seventh part: Message Limits
Yauheni Akhotnikau
 
Sst hackathon express
Sst hackathon expressSst hackathon express
Sst hackathon express
Aeshan Wijetunge
 
Built to Scale: The Mozilla Release Engineering toolbox
Built to Scale: The Mozilla Release Engineering toolboxBuilt to Scale: The Mozilla Release Engineering toolbox
Built to Scale: The Mozilla Release Engineering toolbox
Kim Moir
 
Db2 cloud provisioning
Db2 cloud provisioningDb2 cloud provisioning
Db2 cloud provisioning
Gustav Lundström
 
DSC IIITL Flutter Workshop
DSC IIITL Flutter WorkshopDSC IIITL Flutter Workshop
DSC IIITL Flutter Workshop
DSCIIITLucknow
 
Background Tasks with Worker Service
Background Tasks with Worker ServiceBackground Tasks with Worker Service
Background Tasks with Worker Service
ssusere19c741
 
Managing software product versioning with Gitflow, VSTS and Atlassian SourceTree
Managing software product versioning with Gitflow, VSTS and Atlassian SourceTreeManaging software product versioning with Gitflow, VSTS and Atlassian SourceTree
Managing software product versioning with Gitflow, VSTS and Atlassian SourceTree
Bosnia Agile
 
Jangaroo @ FlashCodersNY
Jangaroo @ FlashCodersNYJangaroo @ FlashCodersNY
Jangaroo @ FlashCodersNYFrank Wienberg
 
What’s new in SObjectizer 5.5.8
What’s new in SObjectizer 5.5.8What’s new in SObjectizer 5.5.8
What’s new in SObjectizer 5.5.8
Yauheni Akhotnikau
 
Mobile Application Development class 001
Mobile Application Development class 001Mobile Application Development class 001
Mobile Application Development class 001
Dr. Mazin Mohamed alkathiri
 

Similar to What is SObjectizer 5.6 (at v.5.6.0) (20)

What is SObjectizer 5.7 (at v.5.7.0)
What is SObjectizer 5.7 (at v.5.7.0)What is SObjectizer 5.7 (at v.5.7.0)
What is SObjectizer 5.7 (at v.5.7.0)
 
What is SObjectizer 5.5
What is SObjectizer 5.5What is SObjectizer 5.5
What is SObjectizer 5.5
 
Dive into SObjectizer 5.5. Eighth Part: Dispatchers
Dive into SObjectizer 5.5. Eighth Part: DispatchersDive into SObjectizer 5.5. Eighth Part: Dispatchers
Dive into SObjectizer 5.5. Eighth Part: Dispatchers
 
Dive into SObjectizer 5.5. Introductory part
Dive into SObjectizer 5.5. Introductory partDive into SObjectizer 5.5. Introductory part
Dive into SObjectizer 5.5. Introductory part
 
ROS Based Programming and Visualization of Quadrotor Helicopters
ROS Based Programming and Visualization of Quadrotor HelicoptersROS Based Programming and Visualization of Quadrotor Helicopters
ROS Based Programming and Visualization of Quadrotor Helicopters
 
What's new in SObjectizer 5.5.9
What's new in SObjectizer 5.5.9What's new in SObjectizer 5.5.9
What's new in SObjectizer 5.5.9
 
Get started with meteor | designveloper software agency meteor prime partner
Get started with meteor | designveloper software agency   meteor prime partnerGet started with meteor | designveloper software agency   meteor prime partner
Get started with meteor | designveloper software agency meteor prime partner
 
Basic iOS Training with SWIFT - Part 1
Basic iOS Training with SWIFT - Part 1Basic iOS Training with SWIFT - Part 1
Basic iOS Training with SWIFT - Part 1
 
IRJET- Build a Secure Web based Code Editor for C Programming Language
IRJET-  	  Build a Secure Web based Code Editor for C Programming LanguageIRJET-  	  Build a Secure Web based Code Editor for C Programming Language
IRJET- Build a Secure Web based Code Editor for C Programming Language
 
Spring boot
Spring bootSpring boot
Spring boot
 
Dive into SObjectizer 5.5. Seventh part: Message Limits
Dive into SObjectizer 5.5. Seventh part: Message LimitsDive into SObjectizer 5.5. Seventh part: Message Limits
Dive into SObjectizer 5.5. Seventh part: Message Limits
 
Sst hackathon express
Sst hackathon expressSst hackathon express
Sst hackathon express
 
Built to Scale: The Mozilla Release Engineering toolbox
Built to Scale: The Mozilla Release Engineering toolboxBuilt to Scale: The Mozilla Release Engineering toolbox
Built to Scale: The Mozilla Release Engineering toolbox
 
Db2 cloud provisioning
Db2 cloud provisioningDb2 cloud provisioning
Db2 cloud provisioning
 
DSC IIITL Flutter Workshop
DSC IIITL Flutter WorkshopDSC IIITL Flutter Workshop
DSC IIITL Flutter Workshop
 
Background Tasks with Worker Service
Background Tasks with Worker ServiceBackground Tasks with Worker Service
Background Tasks with Worker Service
 
Managing software product versioning with Gitflow, VSTS and Atlassian SourceTree
Managing software product versioning with Gitflow, VSTS and Atlassian SourceTreeManaging software product versioning with Gitflow, VSTS and Atlassian SourceTree
Managing software product versioning with Gitflow, VSTS and Atlassian SourceTree
 
Jangaroo @ FlashCodersNY
Jangaroo @ FlashCodersNYJangaroo @ FlashCodersNY
Jangaroo @ FlashCodersNY
 
What’s new in SObjectizer 5.5.8
What’s new in SObjectizer 5.5.8What’s new in SObjectizer 5.5.8
What’s new in SObjectizer 5.5.8
 
Mobile Application Development class 001
Mobile Application Development class 001Mobile Application Development class 001
Mobile Application Development class 001
 

More from Yauheni Akhotnikau

arataga. SObjectizer and RESTinio in action: a real-world example
arataga. SObjectizer and RESTinio in action: a real-world examplearataga. SObjectizer and RESTinio in action: a real-world example
arataga. SObjectizer and RESTinio in action: a real-world example
Yauheni Akhotnikau
 
Actor Model and C++: what, why and how? (March 2020 Edition)
Actor Model and C++: what, why and how? (March 2020 Edition)Actor Model and C++: what, why and how? (March 2020 Edition)
Actor Model and C++: what, why and how? (March 2020 Edition)
Yauheni Akhotnikau
 
[C++ CoreHard Autumn 2018] Actors vs CSP vs Task...
[C++ CoreHard Autumn 2018] Actors vs CSP vs Task...[C++ CoreHard Autumn 2018] Actors vs CSP vs Task...
[C++ CoreHard Autumn 2018] Actors vs CSP vs Task...
Yauheni Akhotnikau
 
Shrimp: A Rather Practical Example Of Application Development With RESTinio a...
Shrimp: A Rather Practical Example Of Application Development With RESTinio a...Shrimp: A Rather Practical Example Of Application Development With RESTinio a...
Shrimp: A Rather Practical Example Of Application Development With RESTinio a...
Yauheni Akhotnikau
 
Акторы в C++: взгляд старого практикующего актородела (St. Petersburg C++ Use...
Акторы в C++: взгляд старого практикующего актородела (St. Petersburg C++ Use...Акторы в C++: взгляд старого практикующего актородела (St. Petersburg C++ Use...
Акторы в C++: взгляд старого практикующего актородела (St. Petersburg C++ Use...
Yauheni Akhotnikau
 
Акторы на C++: стоило ли оно того?
Акторы на C++: стоило ли оно того?Акторы на C++: стоило ли оно того?
Акторы на C++: стоило ли оно того?
Yauheni Akhotnikau
 
25 Years of C++ History Flashed in Front of My Eyes
25 Years of C++ History Flashed in Front of My Eyes25 Years of C++ History Flashed in Front of My Eyes
25 Years of C++ History Flashed in Front of My Eyes
Yauheni Akhotnikau
 
GECon 2017: C++ - a Monster that no one likes but that will outlast them all
GECon 2017: C++ - a Monster that no one likes but that will outlast them allGECon 2017: C++ - a Monster that no one likes but that will outlast them all
GECon 2017: C++ - a Monster that no one likes but that will outlast them all
Yauheni Akhotnikau
 
Dive into SObjectizer 5.5. Tenth part: Mutable Messages
Dive into SObjectizer 5.5. Tenth part: Mutable MessagesDive into SObjectizer 5.5. Tenth part: Mutable Messages
Dive into SObjectizer 5.5. Tenth part: Mutable Messages
Yauheni Akhotnikau
 
Actor Model and C++: what, why and how?
Actor Model and C++: what, why and how?Actor Model and C++: what, why and how?
Actor Model and C++: what, why and how?
Yauheni Akhotnikau
 
Шишки, набитые за 15 лет использования акторов в C++
Шишки, набитые за 15 лет использования акторов в C++Шишки, набитые за 15 лет использования акторов в C++
Шишки, набитые за 15 лет использования акторов в C++
Yauheni Akhotnikau
 
Для чего мы делали свой акторный фреймворк и что из этого вышло?
Для чего мы делали свой акторный фреймворк и что из этого вышло?Для чего мы делали свой акторный фреймворк и что из этого вышло?
Для чего мы делали свой акторный фреймворк и что из этого вышло?
Yauheni Akhotnikau
 
Модель акторов и C++ что, зачем и как?
Модель акторов и C++ что, зачем и как?Модель акторов и C++ что, зачем и как?
Модель акторов и C++ что, зачем и как?
Yauheni Akhotnikau
 
Dive into SObjectizer 5.5. Ninth Part: Message Chains
Dive into SObjectizer 5.5. Ninth Part: Message ChainsDive into SObjectizer 5.5. Ninth Part: Message Chains
Dive into SObjectizer 5.5. Ninth Part: Message Chains
Yauheni Akhotnikau
 
Dive into SObjectizer-5.5. Sixth part: Synchronous Interaction
Dive into SObjectizer-5.5. Sixth part: Synchronous InteractionDive into SObjectizer-5.5. Sixth part: Synchronous Interaction
Dive into SObjectizer-5.5. Sixth part: Synchronous Interaction
Yauheni Akhotnikau
 
Dive into SObjectizer 5.5. Fifth part: Timers
Dive into SObjectizer 5.5. Fifth part: TimersDive into SObjectizer 5.5. Fifth part: Timers
Dive into SObjectizer 5.5. Fifth part: Timers
Yauheni Akhotnikau
 
Dive into SObjectizer 5.5. Fourth part. Exception
Dive into SObjectizer 5.5. Fourth part. ExceptionDive into SObjectizer 5.5. Fourth part. Exception
Dive into SObjectizer 5.5. Fourth part. Exception
Yauheni Akhotnikau
 
Dive into SObjectizer 5.5. Third part. Coops
Dive into SObjectizer 5.5. Third part. CoopsDive into SObjectizer 5.5. Third part. Coops
Dive into SObjectizer 5.5. Third part. Coops
Yauheni Akhotnikau
 
Погружение в SObjectizer 5.5. Вводная часть
Погружение в SObjectizer 5.5. Вводная частьПогружение в SObjectizer 5.5. Вводная часть
Погружение в SObjectizer 5.5. Вводная часть
Yauheni Akhotnikau
 
Обзор SObjectizer 5.5
Обзор SObjectizer 5.5Обзор SObjectizer 5.5
Обзор SObjectizer 5.5
Yauheni Akhotnikau
 

More from Yauheni Akhotnikau (20)

arataga. SObjectizer and RESTinio in action: a real-world example
arataga. SObjectizer and RESTinio in action: a real-world examplearataga. SObjectizer and RESTinio in action: a real-world example
arataga. SObjectizer and RESTinio in action: a real-world example
 
Actor Model and C++: what, why and how? (March 2020 Edition)
Actor Model and C++: what, why and how? (March 2020 Edition)Actor Model and C++: what, why and how? (March 2020 Edition)
Actor Model and C++: what, why and how? (March 2020 Edition)
 
[C++ CoreHard Autumn 2018] Actors vs CSP vs Task...
[C++ CoreHard Autumn 2018] Actors vs CSP vs Task...[C++ CoreHard Autumn 2018] Actors vs CSP vs Task...
[C++ CoreHard Autumn 2018] Actors vs CSP vs Task...
 
Shrimp: A Rather Practical Example Of Application Development With RESTinio a...
Shrimp: A Rather Practical Example Of Application Development With RESTinio a...Shrimp: A Rather Practical Example Of Application Development With RESTinio a...
Shrimp: A Rather Practical Example Of Application Development With RESTinio a...
 
Акторы в C++: взгляд старого практикующего актородела (St. Petersburg C++ Use...
Акторы в C++: взгляд старого практикующего актородела (St. Petersburg C++ Use...Акторы в C++: взгляд старого практикующего актородела (St. Petersburg C++ Use...
Акторы в C++: взгляд старого практикующего актородела (St. Petersburg C++ Use...
 
Акторы на C++: стоило ли оно того?
Акторы на C++: стоило ли оно того?Акторы на C++: стоило ли оно того?
Акторы на C++: стоило ли оно того?
 
25 Years of C++ History Flashed in Front of My Eyes
25 Years of C++ History Flashed in Front of My Eyes25 Years of C++ History Flashed in Front of My Eyes
25 Years of C++ History Flashed in Front of My Eyes
 
GECon 2017: C++ - a Monster that no one likes but that will outlast them all
GECon 2017: C++ - a Monster that no one likes but that will outlast them allGECon 2017: C++ - a Monster that no one likes but that will outlast them all
GECon 2017: C++ - a Monster that no one likes but that will outlast them all
 
Dive into SObjectizer 5.5. Tenth part: Mutable Messages
Dive into SObjectizer 5.5. Tenth part: Mutable MessagesDive into SObjectizer 5.5. Tenth part: Mutable Messages
Dive into SObjectizer 5.5. Tenth part: Mutable Messages
 
Actor Model and C++: what, why and how?
Actor Model and C++: what, why and how?Actor Model and C++: what, why and how?
Actor Model and C++: what, why and how?
 
Шишки, набитые за 15 лет использования акторов в C++
Шишки, набитые за 15 лет использования акторов в C++Шишки, набитые за 15 лет использования акторов в C++
Шишки, набитые за 15 лет использования акторов в C++
 
Для чего мы делали свой акторный фреймворк и что из этого вышло?
Для чего мы делали свой акторный фреймворк и что из этого вышло?Для чего мы делали свой акторный фреймворк и что из этого вышло?
Для чего мы делали свой акторный фреймворк и что из этого вышло?
 
Модель акторов и C++ что, зачем и как?
Модель акторов и C++ что, зачем и как?Модель акторов и C++ что, зачем и как?
Модель акторов и C++ что, зачем и как?
 
Dive into SObjectizer 5.5. Ninth Part: Message Chains
Dive into SObjectizer 5.5. Ninth Part: Message ChainsDive into SObjectizer 5.5. Ninth Part: Message Chains
Dive into SObjectizer 5.5. Ninth Part: Message Chains
 
Dive into SObjectizer-5.5. Sixth part: Synchronous Interaction
Dive into SObjectizer-5.5. Sixth part: Synchronous InteractionDive into SObjectizer-5.5. Sixth part: Synchronous Interaction
Dive into SObjectizer-5.5. Sixth part: Synchronous Interaction
 
Dive into SObjectizer 5.5. Fifth part: Timers
Dive into SObjectizer 5.5. Fifth part: TimersDive into SObjectizer 5.5. Fifth part: Timers
Dive into SObjectizer 5.5. Fifth part: Timers
 
Dive into SObjectizer 5.5. Fourth part. Exception
Dive into SObjectizer 5.5. Fourth part. ExceptionDive into SObjectizer 5.5. Fourth part. Exception
Dive into SObjectizer 5.5. Fourth part. Exception
 
Dive into SObjectizer 5.5. Third part. Coops
Dive into SObjectizer 5.5. Third part. CoopsDive into SObjectizer 5.5. Third part. Coops
Dive into SObjectizer 5.5. Third part. Coops
 
Погружение в SObjectizer 5.5. Вводная часть
Погружение в SObjectizer 5.5. Вводная частьПогружение в SObjectizer 5.5. Вводная часть
Погружение в SObjectizer 5.5. Вводная часть
 
Обзор SObjectizer 5.5
Обзор SObjectizer 5.5Обзор SObjectizer 5.5
Обзор SObjectizer 5.5
 

Recently uploaded

Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 

Recently uploaded (20)

Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 

What is SObjectizer 5.6 (at v.5.6.0)

  • 1. What is SObjectizer-5.6? (at version 5.6.0) SObjectizer Team, May 2019
  • 2. SObjectizer is a framework for building robust multithreaded applications. It is based on async message exchange and uses a mixture of high-level abstractions: ● Actor-Model ● Publish-Subscribe ● Communicating Sequential Processes SObjectizer Team, May 2019
  • 3. SObjectizer’s main ideas and principles were formulated in the middle of 1990s, during the development of SCADA Objectizer project in Development Bureau of System Programming in Homyel, Belarus (1996-2000). SCADA Objectizer’s ideas were reused in the new project SObjectizer-4 in 2002. Evolution of SObjectizer-4 was stopped in 2010 and the development of SObjectizer-5 started. SObjectizer Team, May 2019
  • 4. SObjectizer was an in-house project of Intervale* for the long time. Since 2013 SObjectizer is an independent project which a totally separated from Intervale. Since 2016 the SObjectizer's development and support is performed by stiffstream** . * www.intervale.ru ** stiffstream.com SObjectizer Team, May 2019
  • 5. SObjectizer was used for: ● SMS/USSD traffic service; ● financial transaction handling; ● software parameters monitoring; ● automatic control of the theatre's scenery* ; ● machine learning; ● prototyping of distributed data-acquisition software; ● components of DMP in an advertising platform; ● components of an online game. SObjectizer Team, May 2019* https://habr.com/en/post/452464/
  • 6. SObjectizer can be used for the development of a large, distributed and highly loaded software systems. SObjectizer can also be used for small utilities and quick-and-dirty prototypes. The whole application can be built upon SObjectizer. Or SObjectizer can be used only for a small part of an application developed on the top of Qt, wxWidgets, ACE, Boost, etc. SObjectizer Team, May 2019
  • 8. Maturity SObjectizer is based on ideas that have been put forward in 1995-2000. And SObjectizer itself is being developed since 2002. SObjectizer-5 is continuously evolved since 2010. SObjectizer Team, May 2019
  • 9. Stability From the very beginning SObjectizer was used for business-critical applications, and some of them are still being used in production. Breaking changes in SObjectizer are rare and we approach to them very carefully. For example, branch 5.5 respects compatibility for more that four years. SObjectizer Team, May 2019
  • 10. Cross-platform SObjectizer runs on Windows, Linux, FreeBSD, macOS and Android. SObjectizer Team, May 2019
  • 11. Easy-to-use SObjectizer provides easy to understand and easy to use API with a lot of examples in the SObjectizer's distributive and a plenty of information in the project's Wiki* . SObjectizer Team, May 2019* https://bitbucket.org/sobjectizerteam/sobjectizer/wiki/
  • 12. Free SObjectizer is distributed under BSD-3-CLAUSE license, so it can be used in development of proprietary commercial software for free. SObjectizer Team, May 2019
  • 13. It's not dead! SObjectizer is one of a few live and evolving OpenSource actor frameworks for C++. There are more that 30 releases on SObjectizer-5 since it was open-sourced in May 2013. SObjectizer Team, May 2019
  • 14. It evolves SObjectizer-5.6 has much more features than the first public release of SObjectizer-5 had in 2013. During the evolution, SObjectizer incorporated several features that can be called game-changers... SObjectizer Team, May 2019
  • 15. Some of new features since 2013: ● agents as hierarchical state machines; ● mutability for messages; ● message chains; ● environment infrastructures; ● enveloped messages; ● dead-letter handlers; ● message-tracing; ● stop-guards; ● run-time monitoring; ● ... SObjectizer Team, May 2019
  • 16. Let's dig into some details! SObjectizer Team, May 2019
  • 17. Using SObjectizer-5.6 a programmer must define messages/signals and implement agents for processing them. Agents are created by the programmer and are bound to dispatchers. Dispatchers are responsible for message dispatching and providing of working thread on which agents handle messages. SObjectizer Team, May 2019
  • 18. A programmer can create as many agents as needed. Agent is a lightweight entity. There could be thousands, millions and hundreds of millions of agents. Number of agents is limited only by amount of RAM and the common sense of a programmer. SObjectizer Team, May 2019
  • 19. A traditional "Hello, World" example. This is the main agent: #include <so_5/all.hpp> class hello_actor final : public so_5::agent_t { public: using so_5::agent_t::agent_t; void so_evt_start() override { std::cout << "Hello, World!" << std::endl; // Finish work of example. so_deregister_agent_coop_normally(); } }; SObjectizer Team, May 2019
  • 20. And this is the main() function: int main() { // Launch SObjectizer. so_5::launch([](so_5::environment_t & env) { // Add a hello_actor instance in a new cooperation. env.register_agent_as_coop( env.make_agent<hello_actor>() ); }); return 0; } SObjectizer Team, May 2019
  • 21. Let's see an example of timers and Publish/Subscribe. There will be a producer agent that will distribute new values on a periodic basis. And there will be a couple of consumers on that data. SObjectizer Team, May 2019
  • 22. Define a message with new data: #include <so_5/all.hpp> using namespace std::literals; // This message will be published to a multi-consumer message box on a periodic basis. struct acquired_value { std::chrono::steady_clock::time_point acquired_at_; int value_; }; SObjectizer Team, May 2019
  • 23. Agent-producer (fields and the constructor): class producer final : public so_5::agent_t { const so_5::mbox_t board_; // The destination for acquired_value. so_5::timer_id_t timer_; int counter_{}; // This signal will be sent by the timer. struct acquisition_time final : public so_5::signal_t {}; public: producer(context_t ctx, so_5::mbox_t board) : so_5::agent_t{std::move(ctx)}, board_{std::move(board)} {} SObjectizer Team, May 2019
  • 24. Agent-producer (the main methods): void so_define_agent() override { // A subscription to periodic signal. so_subscribe_self().event( [this](mhood_t<acquisition_time>) { // Publish the next value for all consumers. so_5::send<acquired_value>( board_, std::chrono::steady_clock::now(), ++counter_); } ); } void so_evt_start() override { // Agent will periodically recive acquisition_time signal // without initial delay and with period of 750ms. timer_ = so_5::send_periodic<acquisition_time>(*this, 0ms, 750ms); } }; SObjectizer Team, May 2019
  • 25. Agent-consumer: class consumer final : public so_5::agent_t { const so_5::mbox_t board_; const std::string name_; void on_value(mhood_t<acquired_value> cmd) { std::cout << name_ << ": " << cmd->value_ << std::endl; } public: consumer(context_t ctx, so_5::mbox_t board, std::string name) : so_5::agent_t{std::move(ctx)}, board_{std::move(board)}, name_{std::move(name)} {} void so_define_agent() override { so_subscribe(board_).event(&consumer::on_value); } }; SObjectizer Team, May 2019
  • 26. The main() function: int main() { so_5::launch([](so_5::environment_t & env) { auto board = env.create_mbox(); env.introduce_coop([board](so_5::coop_t & coop) { coop.make_agent<producer>(board); coop.make_agent<consumer>(board, "first"s); coop.make_agent<consumer>(board, "second"s); }); std::this_thread::sleep_for(4s); env.stop(); }); return 0; } SObjectizer Team, May 2019
  • 27. All agents in the example above works on the same default dispatcher. Let's bind them to different dispatchers... SObjectizer Team, May 2019
  • 28. so_5::launch([](so_5::environment_t & env) { auto board = env.create_mbox(); env.introduce_coop([&](so_5::coop_t & coop) { // A separate dispatcher for producer. coop.make_agent_with_binder<producer>( so_5::disp::one_thread::make_dispatcher(env).binder(), board); // And a separate dispatcher for consumers. auto disp = so_5::disp::active_obj::make_dispatcher(env); coop.make_agent_with_binder<consumer>(disp.binder(), board, "first"s); coop.make_agent_with_binder<consumer>(disp.binder(), board, "second"s); }); ... }); SObjectizer Team, May 2019
  • 29. SObjectizer has several ready-to-use dispatchers: ● one_thread. All agents work on a single working thread; ● active_obj. Every agent works on a single dedicated working thread; ● active_group. A single dedicated working thread is allocated for a group of agents; ● thread_pool. A working thread is selected from thread pool. Agents can be moved from one working thread to another. But an agent can’t work on two threads at the same time; ● adv_thread_pool. A working thread is selected from thread pool. Agents can be moved from one working thread to another. Moreover an agent can work on several threads at the same time (if the agent’s event handlers are marked as thread safe); ● prio_one_thread (strictly_ordered and quoted_round_robin). One working thread and dispatching with respect to agent’s priorities; ● prio_dedicated_threads::one_per_prio. One working thread per a priority. SObjectizer Team, May 2019
  • 30. A programmer can create any number of dispatchers needed. This allows to bind agents to different context in such a way that the impact of one agent on another will be minimal. For example: ● one one_thread dispatcher for AMQP-client agent; ● one thread_pool dispatcher for handling requests from AMQP-queues; ● one active_obj dispatcher for DBMS-related agents; ● yet another active_obj dispatcher for agents whose work with HSMs connected to the computer; ● and yet another thread_pool dispatcher for agents for managing all the stuff described above. SObjectizer Team, May 2019
  • 31. SObjectizer even allows writing an application without actors... SObjectizer Team, May 2019
  • 32. You can write a multithreaded application using only plain std::thread and SObjectizer's mchains. mchain in SObjectizer is an analog of CSP-channel. Let's see a ping-pong between worker threads via mchains... SObjectizer Team, May 2019
  • 33. Ping-pong on plain threads and mchains (1) #include <so_5/all.hpp> struct ping { int counter_; }; struct pong { int counter_; }; SObjectizer Team, May 2019
  • 34. Ping-pong on plain threads and mchains (2) void pinger_proc(so_5::mchain_t self_ch, so_5::mchain_t ping_ch) { so_5::send<ping>(ping_ch, 1000); // The initial "ping". // Read all message until channel will be closed. so_5::receive( so_5::from(self_ch).handle_all(), [&](so_5::mhood_t<pong> cmd) { if(cmd->counter_ > 0) so_5::send<ping>(ping_ch, cmd->counter_ - 1); else { // Channels have to be closed to break `receive` calls. so_5::close_drop_content(self_ch); so_5::close_drop_content(ping_ch); } }); } SObjectizer Team, May 2019
  • 35. Ping-pong on plain threads and mchains (3) void ponger_proc(so_5::mchain_t self_ch, so_5::mchain_t pong_ch) { int pings_received{}; // Read all message until channel will be closed. so_5::receive( so_5::from(self_ch).handle_all(), [&](so_5::mhood_t<ping> cmd) { ++pings_received; so_5::send<pong>(pong_ch, cmd->counter_); }); std::cout << "pings received: " << pings_received << std::endl; } SObjectizer Team, May 2019
  • 36. Ping-pong on plain threads and mchains (4) int main() { so_5::wrapped_env_t sobj; auto pinger_ch = so_5::create_mchain(sobj); auto ponger_ch = so_5::create_mchain(sobj); std::thread pinger{pinger_proc, pinger_ch, ponger_ch}; std::thread ponger{ponger_proc, ponger_ch, pinger_ch}; ponger.join(); pinger.join(); return 0; } SObjectizer Team, May 2019
  • 37. SObjectizer is not a silver bullet SObjectizer Team, May 2019
  • 38. SObjectizer supports several concurrency models. SObjectizer makes the development of complex multithreaded applications easier. It's proved by 17 years of usage "in production". But SObjectizer doesn't solve all the problems... SObjectizer Team, May 2019
  • 39. SObjectizer is responsible for: ● in-process message dispatching; ● providing working thread for message processing; ● SObjectizer Run-Time’s parameters tuning; ● collecting of run-time stats (if enabled); ● message delivery process tracing (if enabled). SObjectizer Team, May 2019
  • 40. And SObjectizer-5 doesn't support development of distributed application just "out of box". Additional libraries and tools should be used for that. SObjectizer Team, May 2019
  • 41. Some more info about SObjectizer-5.6.0 SObjectizer Team, May 2019
  • 42. SObjectizer-5.6 is developed using C++17. Supported compilers and platforms: ● Visual Studio 2017-2019, GCC 7.1-9.1, clang 6.0-8.0 ● Windows, Linux, FreeBSD and MacOS. Support of other platforms is possible in the case when SObjectizer’s developers will have an access to those platforms. SObjectizer Team, May 2019
  • 43. Version 5.6.0 is ~30 KLOC of SObjectizer core. Plus ~35 KLOC of tests. Plus ~8 KLOC of samples. Plus SObjectizer’s core documentation*. Plus articles and presentations** (some of them in Russian). * https://bitbucket.org/sobjectizerteam/sobjectizer/wiki ** http://sourceforge.net/p/sobjectizer/wiki/Articles/ SObjectizer Team, May 2019
  • 44. Useful references: Project’s home: https://bitbucket.org/sobjectizerteam/sobjectizer Documentation: https://bitbucket.org/sobjectizerteam/sobjectizer/wiki Google-group: https://groups.google.com/forum/#!forum/sobjectizer Support: https://stiffstream.com