精华内容
下载资源
问答
  • Proactor

    2011-07-10 21:31:23
    This article is extracted from POSA2 as my reading note. The Proactor architectural pattern allows event-driven applications to efficiently
    This article is extracted from POSA2 as my reading note. 
    

    The Proactor architectural pattern allows event-driven applications to efficiently demultiplex and dispatch service requests triggered by the completion of asynchronous operations, to achieve the performance benefits of concurrency without incurring certain of its liabilities.

    The Proactor pattern can be considered an asynchronous variant of the synchronous Reactor pattern. The Reactor pattern is responsible for demultiplexing and dispatching multiple event handlers that are triggered when it is possible to invoke an operation synchronous without blocking. In contrast, the Proactor pattern supports the demultiplexing and dispatching of multiple completion handlers that are triggered by the completion of operations that execute asynchronously.

    The Proactor pattern includes nine participants:

    Handles: Handles are provided by operating systems to identify entities, such as network connections or open files, that can generate completion events. Completion events are generated either in response to external service requests, such as connection or data requests arriving from remote applications, or in response to operations an application generates internally, such as time-outs or asynchronous I/O system calls.

    Asynchronous operations: Asynchronous operations represent potentially long-duration operations that are used in the implementation of services, such as reading and writing data asynchronously via a socket handle. After an asynchronous operation  is invoked, it executes without blocking its caller's thread of control. Thus, the caller can perform other operations. If an operation must wait for application, its execution will be deferred until the event arrives.

    Completion handler: A completion handler specifies an interface that consists of one or more hook methods. These methods represent the set of operations available for processing information returned in the application-specific completion events that are generated when asynchronous operations finish executing.

    Concrete completion handlers: Concrete completion handlers specialize the completion handler to define a particular application service by implementing the inherited hook methods. These hook methods process the results contained in the completion events they receive when the asynchronous operations associated with the completion handler finish executing. A concrete completion handler is associated with a handle that it can use to invoke asynchronous operations itself.

    Asynchronous operation processor: Asynchronous operations are invoked on a particular handle and run to completion by an aynchronous operation processor, which is often implemented by an operating system kernel.

    Completion event queue:
    When an asynchronous operation finishs executing the asynchronous operation processor generates the corresponding completion event. It inserts this event into the completion event queue associated with the handle upon which the operation was invoked. This queue buffers completion events while they wait to be demultiplexed to their associated completion handler.

    Asynchronous event demultiplexer: An asynchronous event demultiplexer is a function that waits for completion events to be inserted into a completion event queue when an asynchronous operation has finished executing. The asynchronous event demultiplexer function then removes one or more completion event results from the queue and returns to its caller.

    Proactor: A proactor provides an event loop for an application process or thread. In this event loop, a proactor calls an asynchronous event demultiplexer to wait for completion events to occur. When an event arrives the asynchronous event demultiplexer returns. The proactor then demultiplexes the event to its associated completion handler and dispatches the appropriate hook method on the handler to process the results of the completion event.

    Initiator: An initiator is an entity local to an application that invokes asynchronous operations on an asynchronous operation processor. The initiator often processes the results of the asynchronous operations it invokes, in which case it also plays the role of a concrete completion handler.


    展开全文
  • Proactor IO

    2021-10-23 12:09:25
    Proactor IO即,在读写IO完成后的通知。 Reactor模式,采用的非阻塞模式,但资源的读写操作仍然是同步的。 而Proactor模式在读写操作上是异步完成的,资源读写靠操作系统完成,而不是应用进程。操作系统完成读写...

    Proactor IO即,在读写IO完成后的通知。

     Reactor模式,采用的非阻塞模式,但资源的读写操作仍然是同步的。

    而Proactor模式在读写操作上是异步完成的,资源读写靠操作系统完成,而不是应用进程。操作系统完成读写后,通知到应用进程完成后续操作。

    • Proactor Initiator 负责创建 Proactor 和 Handler 对象,将 Proactor 和 Handler 注册到内核进程
    • Asynchronous Operation Processor 负责处理注册请求,并处理 I/O 操作;
    • Asynchronous Operation Processor 完成 I/O 操作后通知 Proactor
    • Proactor 根据不同的事件类型回调不同的 Handler 进行业务处理
    • Handler 完成业务处理
    展开全文
  • 模拟Proactor

    2017-02-07 10:33:10
    前面在【Reactor and Proactor】中讨论了那两种模式,因为Proactor模式需要操作系统级别的支持。所以这里看看融合Reactor和Proactor的解决方案:[color=blue]使用Reactor模拟Proactor[/color]。 使用Reactor模拟...
    前面在【Reactor and Proactor】中讨论了那两种模式,因为Proactor模式需要操作系统级别的支持。所以这里看看融合Reactor和Proactor的解决方案:[color=blue]使用Reactor模拟Proactor[/color]。
    

    使用Reactor模拟Proactor的思路其实很简单,就是让Reactor模式中的事件分享者在得知事件发生的时候,让事件分享者来读写数据,读写完成后把数据放到事件处理者提供的缓冲区里面。再通知事件处理者:你所关心的事件已经完成[color=red](注意这里不是发生而是完成)[/color]。然后事件处理者就直接在自己所提供的缓冲区里面获取数据。事件处理者需要提供:用于存放读到数据的缓存区,读的数据大小,或者用于存放外发数据的缓存区,请求完后的回调函数。
    展开全文
  • Proactor.pdf

    2015-10-12 16:07:40
    Proactor An Object Behavioral Pattern for Demultiplexing and Dispatching Handlers for Asynchronous Events.pdf
  • tpd_reactor_proactor.pdf

    2021-08-23 12:38:08
    reactor和proactor的区别
  • reactor 和 proactor

    2021-03-20 09:54:48
    一句话总结区别就是: ...proactor: 你给我收十个字节,收好了跟俺说一声。 Reactor: libevent/libev/libuv/ZeroMQ/Event Library in Redis 主要是异步的IO需要操作系统支持; Proactor IOCP/Boost.Asio ...

    一句话总结区别就是:

    reactor:能收了你跟俺说一声。
    proactor: 你给我收十个字节,收好了跟俺说一声。

    Reactor:
    libevent/libev/libuv/ZeroMQ/Event Library in Redis

    主要是异步的IO需要操作系统支持;

    Proactor
    IOCP/Boost.Asio

     

    展开全文
  • Reactor与Proactor

    2020-09-20 16:58:58
    reactor,proactor
  • Proactor VS Reactor

    2019-10-30 16:02:41
    proactor vs reactor 先发几本proactor 与 reactor 相关的电子书: http://files.cnblogs.com/files/f1194361820/react...
  • Proactor模式详解

    千次阅读 2018-08-27 23:07:31
      proactor结构模式在异步操作完成后触发服务请求的分配和分发 。 1. 举个例子吧   考虑一个需要同时处理多个请求的网络服务程序,比如,一个高效的WEB服务器需要并发的处理来自于不同客户端浏览器的HTTP...
  • 异步I/O模型则用于实现Proactor模式 最后我们会使用同步I/O方式模拟出Proactor模式 一、Reactor模式 Reactor模式特点 它要求主线程(I/O处理单元)只负责监听文件描述符上是否有事件发生,有的话就立即将时间...
  • 图解 Reactor 和 Proactor

    2021-10-17 21:50:35
    图解 Reactor 和 Proactor Reactor Reactor 和 Proactor 是两个高性能网络模式。 Reactor 模式也叫 Dispatcher 模式,即 I/O 多路复用监听事件,收到事件后,根据事件类型分配(Dispatch)给某个进程/线程。 Reactor ...
  • Proactor 与 Reactor

    2019-02-27 07:58:39
    Reactor和Proactor对比以及优缺点 两种高效的事件处理模型:Reactor模式和Proactor模式 在高性能的I/O设计中,有两个比较著名的模式Reactor和Proactor模式,其中Reactor模式用于同步I/O,而Proactor运用于异步I/O...
  • Proactor设计模式

    千次阅读 2019-03-06 20:33:30
    主动器Proactor Proactor模式结构 Proactor主动器模式包含如下角色 Handle 句柄;用来标识socket连接或是打开文件; Asynchronous Operation Processor:异步操作处理器;负责执行异步操作,一般由操作系统内核...
  • Proactor模式 论文

    2019-01-30 22:23:30
    Proactor An Object Behavioral Pattern for Demultiplexing and Dispatching Handlers for Asynchronous Events 论文Irfan Pyarali, Tim Harrison, Douglas C. Schmidt, Thomas D. Jordan 2012-12-10 23:58  T...
  • Reactor和Proactor模式

    2020-09-27 08:11:57
    1.Reactor和Proactor模式的比较 两种I/O多路复用模式:Reactor和Proactor。一般地,I/O多路复用机制都依赖于一个事件多路分离器(Event Demultiplexer)。分离器可将来自事件源的I/O事件分离出来,并分发到对应的read/...
  • ACE proactor

    2010-07-08 19:11:00
    ACE proactor
  • Proactor模式

    2014-11-04 22:06:00
    第8章前摄器(Proactor):用于为异步事件多路分离和分派处理器的对象行为模式 Irfan Pyarali Tim Harrison Douglas C. Schmidt Thomas D. Jordan 摘要   现代操作系统为开发并发应用提供了多种机制。同步多...
  • IO设计模式:Reactor和Proactor对比Reactor和Proactor反应器ReactorReactor模式结构Proactor模式Proactor模式结构业务流程及时序图对比两者的区别主动和被动实现优点缺点适用场景 Reactor和Proactor 平时接触的开源...
  • Proactor架构模式

    2018-04-28 23:08:12
    http://www.laputan.org/pub/sag/proactor.pdf
  • Proactor和Reactor

    2019-08-09 17:50:00
    Proactor: 事件句柄初始化一个异步读操作,此时该句柄并不在意异步操作结果,而是要获得完成事件而注册 事件多路器等待直到io事件完成 当事件多路器等待io事件时,操作...
  • 并发IO模型 Proactor

    2021-02-04 15:10:01
    Proactor:  Proactor将所有I/O操作都交给主线程和内核来处理,工作线程仅仅负责业务逻辑。使用异步I/O模型(aio_read和aio_write)来实现Proactor模式的工作流程是: 1、主线程调用aio_read向内核注册...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 6,183
精华内容 2,473
关键字:

proactor