
Reactor Pattern 介绍
上世纪末 C10K 问题被提出来后, 各种程序设计模式被提出来解决这个问题. Reactor Pattern 是其中一个.
Reactor Pattern 由 ... 在其论文 ... 中提出, 它以同步的方式侦听多个事件源已经处理这些事件源的方式. Reactor Pattern 包含如下几个组件:
• Handles - 这是同步侦听器所侦听的事件源集合, 对应的可能是文件描述符, 定时器, 同步对象等
• Synchronous Event Demultiplexer - 同步侦听器, 会阻塞在所有的 Handles 上, 只要有一个 Handle 可以被无阻塞的操作, 就会返回. 典型的如 Linux/Win32 平台的 select 系统调用.
• Initiation Dispatcher
• Event Handler
使用 Reactor Pattern 的网络库
• Interview
• ACE
• 陈硕的 Muduo
与事件驱动 (Event Driven) 的区别
可能我们听得比较多的是事件驱动模型而不是 Reactor 模式, 事件驱动模型实际上是很笼统的定义, 实现事件驱动的方式可以有很多, Reactor 模式以及后面要介绍的 Proactor 是实现事件驱动的两种主要方式.
Leave Reactor Pattern 介绍 to:
Read more #programming posts
Best Posts From cifer
We have not curated any of cifer's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.