C # Multi-Threading vs. async

Source: Internet
Author: User

Multi-threading and asynchronous programming have always been small white into a (-) hurdle. Usually also used a lot of multi-threading and asynchronous operations, here to record.

The concept of async and multithreading

You may meet the need to crawl Web data, this time if the data is very large. Then a single thread will cause a wait. If you use thread threads at this time, it will prevent the UI line from incurring, but it will still be slow. This is the typical multithreaded error usage scenario.

So what do we need to do to deal with this scenario? The first thing to understand is the operation of Web data, IO operations.

IO operation: An IO stream is actually an unstructured sequence of bytes or sequences of characters that are inserted and removed as IO operations. Are the operations that are based on the IO stream.

Dma:direct Memory Access, is the mode of IO operation. Direct memory access is a mode of data interaction that does not go through the CPU. Does not deplete CPU resources.

Asynchronous difference: Async is the full use of the DMA function to release CPU pressure.

C # Multi-Threading vs. async

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.