where/how can I find whether a .net class uses IOCP?

前端 未结 2 511
孤城傲影
孤城傲影 2020-12-29 06:04

Update

I asked the wrong question, rephrased (based on the great info on answers and comments):

Is there any good source on .net\'s as

2条回答
  •  不知归路
    2020-12-29 06:05

    I/O completion ports are a strong platform implementation detail, one that .NET cannot blindly depend on to be available. And it doesn't, it leaves it up to the CLR host to implement the glue to the operating system support for it. The underlying hosting interface is IHostIoCompletionManager, available since .NET 2.0

    So if you want a hard guarantee the they actually get used then you need to get the source of the CLR host that you use. This is hard to come by, there are many and you'd need to apply to a job at Microsoft to get access to the source. Only the SSCLI20 host is available in source, it is dated and covers only the default host. Which was itself tweaked to allow the PAL to provide the I/O completion port, surely not actually present in the real CLR hosts you'd ever run on.

    You were not specific about what platforms you consider. Some guesstimates:

    • ASP.NET: yes, I/O completion ports are a big deal for sockets
    • SQL Server: pretty likely, but no slamdunk, it has a knack for doing things differently
    • Desktop: yes, for any .NET version >= 2.0 that runs on the NT branch
    • Compact: definitely not
    • Micro: definitely not
    • XBox: unlikely, OS details are a big mystery
    • Silverlight: Windows version's CoreCLR.dll uses it but no ThreadPool.BindHandle
    • Phone7: similar to Silverlight
    • Phone8: big mystery, probably.

    Emphasizing that these are merely educated guesses that are not backed by proof. The question is otherwise fairly strange, it is not like you'd have an alternative if you find out that async I/O was done by overlapped I/O.

提交回复
热议问题