zzz6519003 / blog

My blog about coding
4 stars 1 forks source link

erlang day 1-1 #88

Open zzz6519003 opened 7 years ago

zzz6519003 commented 7 years ago

Processes have their own resources; threads have their own execution path but share resources with other threads in the same process.

To coordinate control between two applications sharing resources, threading systems require semaphores, or operating system level locks. Erlang takes a different approach. It tries to make processes as lightweight as possible.

Like Io, Armstrong’s creation uses actors for concurrency, so message passing is a critical concept.

You can also hot-swap code, meaning you can replace pieces of your application without stopping your code. This capability allows far simpler maintenance strategies than similar distributed applications. Erlang combines the robust “Let it crash” error strategies with hot-swap- ping and lightweight processes that you can start with minimal over- head. It’s easy to see how some applications run for years at a time without downtime.

Yes, friends, reliability can be cool.

multiple function entry points should look familiar to you

zzz6519003 commented 4 years ago

Actor本质上就是接收消息并采取行动处理消息的对象。它从消息源中解耦出来,只负责正确识别接收到的消息类型,并采取相应的行动。