Erlang-style parallel programming in. NET Applications

Source: Internet
Author: User

Erlang can be used to write highly scalable parallel applications. Millions of lightweight components are often displayed, which are called actor similar to thread components. Unfortunately, this often requires you to use Erlang, a relatively mysterious programming language, to rewrite all the code. However, we also have other options, such as the development of a well-known CCR platform developed by the. NET robot department.

As an Actor-based language, Erlang achieves high concurrency through the Actor model. In this model, the most basic Parallel unit is not a thread or fiber, but a more lightweight thing. As a "process" in Erlang, each parallel unit occupies only about 1200 bytes of basic resources in a 32-bit system. In contrast, by default, every thread in the Windows operating system allocates 1 MB space on the stack. In addition, additional space is required for Bookkeeping and local thread storage. Because it is very lightweight, an application easily supports millions of processes for concurrent processing.

At any time, most processes are idle. When a process receives a message, the running platform assigns it a thread to respond to the message. A response may create a new process, send messages to other processes, or change its status. Once the message is processed, the process will die or wait for the next message.

The message processing system achieves high-end concurrency and high performance. Each message is sent asynchronously, making processes highly independent of each other. The platform can use messages to determine which process to wake up. Since each process can be processed by any thread, context switching operations that are relatively expensive can be greatly reduced.

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.