Fix issue #179: Leader Followers Pattern (#1189)

* add leader followers pattern

* use var and streams instead in App::execute

* use logger instead of printing to system output stream
This commit is contained in:
Zhang WH
2020-03-27 03:14:44 +08:00
committed by GitHub
parent 6ce33ed6df
commit be1c0b8143
15 changed files with 737 additions and 0 deletions

View File

@ -0,0 +1,32 @@
---
layout: pattern
title: Leader/Followers
folder: leader-followers
permalink: /patterns/leader-followers/
categories: Concurrency
tags:
- Performance
---
## Intent
The Leader/Followers pattern provides a concurrency model where multiple
threads can efficiently de-multiplex events and dispatch event handlers
that process I/O handles shared by the threads.
## Class diagram
![Leader/Followers class diagram](./etc/leader-followers.png)
## Applicability
Use Leader-Followers pattern when
* multiple threads take turns sharing a set of event sources in order to detect, de-multiplex, dispatch and process service requests that occur on the event sources.
## Real world examples
* [ACE Thread Pool Reactor framework](https://www.dre.vanderbilt.edu/~schmidt/PDF/HPL.pdf)
* [JAWS](http://www.dre.vanderbilt.edu/~schmidt/PDF/PDCP.pdf)
* [Real-time CORBA](http://www.dre.vanderbilt.edu/~schmidt/PDF/RTS.pdf)
## Credits
* [Douglas C. Schmidt and Carlos ORyan - Leader/Followers](http://www.kircher-schwanninger.de/michael/publications/lf.pdf)