0

I'm writing a webserver which I want to work well regardless of the OS it's run on. I've been using the same implementation style as Does C# AsyncCallback creates a new thread?

I have been searching for info about whether this is a good implementation or if I should go for a threadpool. The asker's chosen answer to the above question seems to say that using AsyncCallback to handle requests is a very good approach and that I should be using it instead of using a threadpool.

But I am wondering if that is true for any operating system or if it only applies to Windows?

Community
  • 1
  • 1
Chris Rollins
  • 550
  • 3
  • 9

1 Answers1

1

I have been searching for info about whether this is a good implementation or if I should go for a threadpool. The asker's chosen answer to the above question seems to say that using AsyncCallback to handle requests is a very good approach

Indeed Yes, Async-Await makes sense in this case, as its designed for the IO based calls, remote calls, where except dispatching the request to a remote host nothing much is expected from the caller, so a thread pool thread would be a sheer waste as it waits for the call to return, while holding on to important resources. In fact Async-Await would help in making the system far more scalable, since calls are queued on hardware (device driver) based IO completion ports.

But I am wondering if that is true for any operating system or if it only applies to Windows?

As you are trying to use it on Mono (Linux), if the functionality is exposed, then it is bound to work the same way as expected in Windows, though the compatibility details here say Yes. Adding my perspective, as mentioned above, since this is a purely a hardware based functionality being harnessed, which is implemented on same lines as Windows in case of Linux and other Operating systems too, therefore its quite certain that it is able to work on same perspective, though the internal implementation, API calls and optimization would certainly differ, but for the end user the experience of using it will not change

Mrinal Kamboj
  • 11,300
  • 5
  • 40
  • 74