Reactor pattern - Introduction by wiki
The reactor design pattern is an event handling pattern for handling service requests deliveredconcurrently to a service handler by one or more inputs. The service handler thendemultiplexes the incoming requests and dispatches them synchronously to the associated request handlers.
[edit]Structure
[edit]PropertiesAll reactor systems are single threaded by definition,but can exist in a multithreaded environment. [edit]BenefitsThe reactor pattern completely separates application specific code from the reactor implementation,which means that application components can be divided into modular,reusable parts. Also,due to the synchronous calling of request handlers,the reactor pattern allows for simple coarse-grain concurrency while not adding the complexity of multiple threads to the system. [edit]LimitationsThe reactor pattern can be more difficult to debug[citation needed] than a procedural pattern due to the inverted flow of control. Also,by only calling request handlers synchronously,the reactor pattern limits maximum concurrency,especially onSMP hardware. The scalability of the reactor pattern is limited not only by calling request handlers synchronously,but also by the demultiplexer. The original Unixselect and poll calls,for instance,have a maximum number of descriptors that may be polled and have performance issues with a high number of descriptors.[1] (More recently,more scalable[citation needed] variants of these interfaces have been made available: /dev/poll in Solaris, [edit]Implementations[edit]C
[edit]C++
[edit]Java
[edit]C#
[edit]Perl
[edit]Python
[edit]Ruby
[edit]JavaScript
[edit]Tcl
[edit]See also
[edit]References
[edit]External links
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |