为了在WIN32和POSIX平台上开发高性能的网络应用,一个功能完整的能在所有平台上工作的模型是很有必要的,很显然异步IO在WIN32平台上能获得最佳性能,当然只能选择用Proactor模型。然而大多数平台上的POSIX AIO系统并不支持Proactor模型。而且,Thread Pool模型效率更好些,因为很多POSIX AIO实现是用线程来实现的(系统内部没有异步机制,用线程来模拟的),此外,POSIX AIO标准不支持异步accept, connect和datagram 操作。
For the development of high-performance networked applications on WIN32 and POSIX, it is highly desirable to have a full-fledged single pattern working on both platforms. It is obvious that the asynchronous I/O gives the best performance on WIN32 platforms and the Proactor pattern is the only one choice to be made. Yet, the status of POSIX AIO subsystems on many platforms does not allow making a choice of Proactor pattern as a pattern for production applications. Moreover, the Thread Pool Reactor can give a better performance because many POSIX AIO implementations spawn “hidden” threads instead of kernel AIO solution. In addition, POSIX AIO standard does not support asynchronous accept, connect and datagram operations.As a result the goal of this work is:
因此我们开发了有如下功能的ACE的附加包
1、 开发模拟AIO设备的POSIX Proactor
2、提供各种异步操作支持
3、使Proactor能跟现有的程序兼容
4、至少效率不比TP_Reactor差
5、开发能同时支持POSIX AIO API和模拟的API
6、切换所用的Proactor的时候用户程序不必要重新编译(比如从AIO模拟 切换到POSIX AIO或者相反)
7、Proactor可以在运行时候通过动态配置来选择,而不需要程序员写死在代码中,因为这应该属于系统管理员来选择恰当的模型。
8、Proactor应该有公开的接口,很容易加上新的实现。
§ To develop POSIX_Proactor which will be able to emulate AIO facilities
§ To provide all asynchronous operations set support
§ To make Proactor compatible with existing users applications
§ To achieve the performance at least not less than TP_Reactor performance
§ To develop Proactor which will support both POSIX AIO API and emulation API
§ User applications should not be recompiled if Proactor selects another internal engine, i.e. switches from POSIX AIO to the AIO emulation and vice versa.
§ Proactor should be configurable at run-time to make programmer free from selection of the internal engine, as it is the task of the system administrator to select the right engine.
§ Proactor should have open interfaces to add new engine(s). 
2. New features of POSIX Proactor 新POSIX Proactor在POSIX平台上都能工作,而不管是否有POSIX AIO支持。假如平台有POSIX AIO支持(稳定而高效)POSIX_Proactor会使用本地AIO实现。假如平台不支持或者支持有问题,POSIX_Proactor会模拟AIO支持(效率不比TP_Reactor差)
The new POSIX_Proactor works on any POSIX platform regardless of POSIX AIO support. If platform includes AIO which implementation is reliable and fast, POSIX_Proactor can rely on it and use native implementation. If platform does not have AIO support or has AIO implementation broken, POSIX_Proactor will emulate AIO and will give performance at least not worse than given by Thread Pool Reactor.POSIX_Proactor提供全面的异步操作包括异步数据报操作。
POSIX_Proactor provides full asynchronous operations set including asynchronous datagram operations.新的POSIX_Proactor跟现有的程序完全兼容。
The new POSIX_Proactor is fully compatible with existing applications.因此,我们可以在WIN32和POSIX平台下都可以使用高性能的Proactor模型了。
Therefore, we can use the Proactor as realiable pattern for high-performance networked application on both platforms WIN32 and POSIX.

解决方案 »

  1.   

    说了半天,忘了贴网址了,
    http://www.terabit.com.au/docs/Proactor2.htm
    下面是license
    THE TERABIT PUBLIC LICENSE.Copyright (C) 2003 Terabit Pty Ltd, Australia.
    The intent of this license is to establish the right to share and change 
    the software regulated by this license under the open source model. This license applies to any software containing a notice placed 
    by the copyright holder saying that it may be distributed and used only under
    the terms of the Terabit Public License. 
    Such software is herein referred to as the Software. 
    This license covers modification and distribution of the Software, 
    use of third-party application programs based on the Software, 
    and development of other software, which uses the Software. Granted Rights 1. You are granted the non-exclusive rights set forth in this license provided
    you agree to and comply with any and all conditions in this license. 
    Whole or partial distribution of the Software, or software items that link
    with the Software, in any form signifies acceptance of this license. 2. You may copy and distribute the Software in an unmodified form provided 
    that the entire package, including - but not restricted to - copyright,
    trade notices and disclaimers, as released by the initial developer 
    of the Software, is distributed. 3. You may make modifications to the Software and distribute your modifications,
    in a form that is  separate from the Software, such as patches. 
    The following restrictions apply to modifications: a. Modifications must not alter or remove any copyright notices in the Software.b. When modifications to the Software are released under this license,
    a non-exclusive royalty-free right is granted to the initial developer of
    the Software to distribute your modification in future versions of the Software
    provided such versions remain available under these terms in addition to any 
    other license(s) of the initial developer. 4. You may distribute machine-executable forms of the Software or 
    machine-executable forms of modified versions of the Software, 
    provided that you meet these restrictions: a. You must include this license document in the distribution. b. You must ensure that all recipients of the machine-executable forms are 
    also able to receive the complete machine-readable source code 
    to the distributed Software, including all modifications, without any charge
    beyond the costs of data transfer, and place prominent notices in 
    the distribution explaining this. If you do not wish to comply with this 
    condition, you may still distribute machine-executable forms of the Software 
    or modified Software provided you receive written permission from  
    Terabit Pty Ltd. c. You must ensure that all modifications included in the machine-executable
    forms are available under the terms of this license. 5. You may develop application programs, reusable components and other software 
    items that link with the original or modified versions of the Software. 
    These items, when distributed, are subject to the following requirements: a. You must ensure that all recipients of machine-executable forms of these 
    items are also able to receive and use the complete machine-readable source 
    code to the items without any charge beyond the costs of data transfer.
    If you do not wish to comply with this condition, you may still distribute 
    machine-executable forms of the items that link with the Software or
    modified Software provided you receive written permission from Terabit Pty Ltd.b. You must explicitly license all recipients of your items to use and
    re-distribute original and modified versions of the items in both 
    machine-executable and/or source code forms. Provided the recipients disclose
    the source code forms of any such items, they must be able to use and 
    re-distribute them to anyone they choose without any charges whatsoever. c. If the items are not available to the general public, and the initial
    developer of the Software requests a copy of the items, then you must supply
    one. Limitations of Liability In no event shall the initial developers or copyright holders be liable for
    any damages whatsoever, including - but not restricted to - lost revenue or
    profits or other direct, indirect, special, incidental or consequential damages,
    even if they have been advised of the possibility of such damages, except to 
    the extent invariable law, if any, provides otherwise. No Warranty The Software and this license document are provided AS IS with 
    NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, 
    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Choice of Law This license is governed by the laws of New South Wales, Australia.
    Any user of the Software irrevocably submits to the jurisdiction of 
    the Supreme Court of New South Wales, Australia, and any disputes 
    in connection with this license or the Software shall be settled 
    by the appropriate courts of New South Wales, Australia.