CPU bound and IO bound job with async await RRS feed

  • Question

    1. Will your code be "waiting" for something, such as data from a database?

      If your answer is "yes", then your work is I/O-bound.

    2. Will your code be performing a very expensive computation?

      If you answered "yes", then your work is CPU-bound

    so when i am iterating in list and populate my datatable then this kind of job will be consider as CPU boud or IO bound ?

    i guess cpu i right?

    when i am updating UI with in for loop then his kind of job will be consider as CPU boud or IO bound ?

    also guide me should i do the above job using Task.Run or normal async await ?


    Sunday, December 23, 2018 5:09 PM


All replies

  • There's no single answer.  When you're reading from a database that resides on a separate database server, USUALLY that transaction will be I/O bound, because your code has to wait for a response to be transmitted from the other server.  If you are in a tight loop updating a UI from an array that's part of your own code, then there is no I/O going on.  That would be CPU bound.  However, updating a UI has to be done from the main thread.  You can't spin that off to a separate thread.

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Monday, December 24, 2018 3:04 AM
  • Hi Sudip_inn,

    Thank you for posting here.

    For your question, you could refer to the link below. It shows examples about how to use async await with  I/O- and CPU-bound.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, December 24, 2018 7:53 AM