Liste des Groupes | Revenir à c arch |
Chris M. Thomasson wrote:On 5/20/2024 8:44 AM, EricP wrote:
>Thanks. I have never used the thread-per-client model in my servers.
I have been using async I/O and Asynchronous Procedure Calls (APC)
for I/O completion on Windows for 30+ years. IO Completion Ports (IOCP),
which were added to Windows later, have similar functionality
(perhaps IOCP might have slightly better scaling with many cores).
I never tried APC wrt IO and a socket server on windows before! I have
created several types wrt the book I finally found on the wayback
machine. IOCP was the thing to use.
APC's are I/O completion callback subroutines with 1 to 3 arguments.
I use them to a build callback driven state machines for each network
I/O channel, similar to device drivers. Each network channel requires
only a small amount of user mode memory, and all server network connections
can be serviced by a single thread or a small fixed pool of comms threads.
This keeps the cost for each new connection to mostly just the kernel's
network memory.
>
WinNT originally only had APC's. It inherited the concept from
VMS's Asynchronous System Trap (AST), which inherited the concept
from RSX-11 on PDP-11.
The difference between Windows APC and RSX/VMS AST is how they are delivered.
Despite the name, Windows user mode APC's are NOT delivered to the thread
asynchronously as interrupts but only at specified delivery points,
which means user mode APC's are essentially a synchronous polled delivery.
whereas VMS AST's are delivered at any time using interrupts semantics.
(Windows does have real asynchronous-delivery APC's but inside the kernel
where they are used to interrupt or wake up a thread for I/O completion
and various other things.)
User mode APC's are simpler from a user mode programming point of view than
VMS's AST's but because APC's have a polled delivery you can't use user mode
APC's to interrupt and force a thread to do something, as AST's can.
Les messages affichés proviennent d'usenet.