A new method and framework for implementing network protocol processing utilizing
a combination of application threads and a dedicated thread to process IO completions
in a completion queue that automatically detects and adjusts thread priorities
to alleviate manual intervention. According to the present invention, as data transfer
operations are completed by the network interface, completion information identifying
the data transfer operations is posted on the completion queue. The completion
information is read and processed by a combination of application and dedicated
threads running in the system. A method monitors performance of the system to detect
whether poor processor utilization or excessive context switches occurs, in which
case a different thread is used to process the completion information. In order
to context switch to a different thread, the priority level of the dedicated thread
is set to a HIGH level to utilize the dedicated thread or the priority level of
the dedicated thread is set a LOW level to utilize an application thread.