BEAM(Erlang VM)是否并行进行垃圾收集? [英] Does BEAM (the Erlang VM) do garbage collection in parallel?

查看:91
本文介绍了BEAM(Erlang VM)是否并行进行垃圾收集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在学习Elixir,并希望我了解垃圾回收在Erlang VM中的工作原理。
$ b


  • 每个VM级进程都有自己的堆

  • 如果该堆在终止之前没有填满,则被丢弃这个过程不需要GC

  • 填充的堆是单独的垃圾,并行,所以GC不会停止世界,

    解决方案

    / div>


    取垃圾收集。当它是以其他
    语言收集垃圾的时候,整个系统必须停止,垃圾收集器
    运行。如果您的计算机程序是
    应该运行一次,写一些输出,然后退出,这种方法是非常好的。但是,在
    长时间运行的应用程序(如桌面,移动或服务器
    程序)中,此策略偶尔会冻结UI,缓慢的
    响应时间。另一方面,Erlang计划可以有数千美元的独立堆,分别是垃圾收集的;在这个
    的方式中,垃圾收集的性能损失分摊在
    以上,所以长时间运行的应用程序不会神秘地停止
    在垃圾回收器运行时不时响应。


    Evan Miller是受欢迎的芝加哥老板框架的创始人。



    所以我相信erlang垃圾同时收集,也就是说,各种堆是独立于垃圾收集另一个。是否存在任何并行性取决于您的节点是否在多个核心上运行,但如果是,则垃圾回收并行完成,是的。


    I'm learning Elixir and want to be sure I understand how garbage collection works in the Erlang VM.

    My understanding is this:

    • Each VM-level process has its own heap
    • If that heap doesn't fill up before it terminates, it's discarded with the process and no GC is needed
    • Heaps that do fill up are garbage collected individually, in parallel, so GC doesn't "stop the world", just that one process

    Is this correct?

    解决方案

    Take garbage collection. When it's time to collect garbage in other languages, the entire system has to stop while the garbage collector runs. This approach is perfectly fine if your computer program is supposed to run once, write some output, and then quit. But in long-running applications, such as desktop, mobile, or server programs, this strategy results in occasionally frozen UIs and slow response times. Erlang programs, on the other hand, can have thousands of independent heaps which are garbage-collected separately; in this way, the performance penalty of garbage collection is spread out over time, and so a long-running application will not mysteriously stop responding from time to time while the garbage collector runs.

    Evan Miller, creator of the popular Chicago Boss framework.

    So I believe erlang garbage collects concurrently, that is, the various heaps are garbage collected independently of one another. Whether there is any parallelization depends on whether your node is running on multiple cores or not, but if so then the garbage collection is done in parallel, yes.

    这篇关于BEAM(Erlang VM)是否并行进行垃圾收集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆