none
Use of System Thread in WDK WSK Sample RRS feed

  • Question

  • In the WDK WSK sample the event callbacks diligently queue operations to a system thread where the event is actually handled. I can certainly see the need for using PCASSIVE mode in some cases - such as interpreting strings and performing other operations that can only be done at IRQL == PASSIVE_LEVEL or when handling the event requires significant time.

    However, it appears to be that most of the echoing done in the WSK echo sample could actually be done at IRQL == DISPATCH_LEVEL without requiring the use of the system thread. For example, just send the echo from within the receive event callback.

    My question really is whether performing operations exclusively in the event callbacks has a performance drawback that makes using the system thread a preferred approach? IOW: Is using the thread fundamentally better than performing work in the vent handler.

    Of course, the work in the event handler would have to be brief. I am specifically interested in sending data (the same date) in a receive event handler.

    Thomas F. Divine

     


    Thomas F. Divine http://www.pcausa.com
    Friday, August 26, 2011 5:57 PM

All replies

  • OK. Let me dig into this a different way...

    The WDK WSK TCP Echo sample uses a system thread for all operations. The sample docs say:

    "The application is designed to use a single worker thread to perform all of its processing."

    The original performed the listen socket create, set option and bind sequence in the system thread and waited on a sync event at each step.

    Is there anything that prevents using a modified sequence of I/O completion callbacks that operate in arbitrary thread context?

    First start the socket creation, and in the socket creation callback (if successful) initiate setting the socket option with it's own completion callback. In the set option callback (if successful) initiate the bind operation. Finally the bind completion routine should be called.

     

     


    Thomas F. Divine http://www.pcausa.com
    Sunday, August 28, 2011 5:51 PM