Matlus
Internet Technology & Software Engineering

Tagged With: Asynchronous

HttpWebRequest - Asynchronous Programming Model/Task.Factory.FromAsyc

The Asynchronous Programming Model (or APM) has been around since .NET 1.1 and is still (as of .NET 4.0) the best/recommended solution for asynchronous I/O. Many people go down the route of using a multi-threaded approach to try get speedup when the workload is I/O bound. Using multiple threads to do I/O bound tasks such as Disk I/O and Network I/O, won't (in most cases) give you any speed up and in fact could end up hurting performance. If the workload is compute bound (rather than I/O bound) then it makes complete sense to use multiple threads (provided you have multiple cores and the work is fairly long running and so justifies the overhead of spawning and managing multiple threads), as discussed in this post [...]

Getting the No Of CPUs and Cores

Using WMI (Windows Management Instrumentation) it is really simple to get the all kinds of weird and useful information about the hardware of a computer. Here I use from the assembly/namespace to get at information on the CPU. In particular:
  • No of Cores
  • No of Logical Processors
  • No of Physical Processors
  • Hardware Bitness (32/64 bit etc.)
  • CPU Architecture (x86, x64, Itanium etc.)
Categorized Under:  
Tagged With:   

Code Gem: Snippets 

Posted on

IAsyncResult–Making Existing methods Asnchronous

The APM or Asynchronous programming model has been in .NET since the beginning. There are quite a few BCL classes that use this programming model to effectively provide asynchronous methods to methods that also have synchronous counterparts. But what if you want to make one of your existing methods asynchronous? In this post I show you how simple it is to make an existing synchronous method available as an asynchronous method. Before we go down that route, let me say that I assume you're somewhat familiar with using asynchronous methods[...]