【问题标题】:Can I change the priority of a process in Erlang?我可以在 Erlang 中更改进程的优先级吗?
【发布时间】:2012-11-14 11:06:46
【问题描述】:

我从这里http://cs.ucsb.edu/~puneet/reports/erlang.pdf(第 4.4 节)了解到 Erlang 中的进程调度基于 4 个不同的队列 - 其中一个被指定为“最高优先级”。我有一个 Erlang 程序,我想分配一个进程,以便它的指令加入这个队列。有没有办法做到这一点?这样做时有什么注意事项吗?

【问题讨论】:

    标签: erlang scheduling


    【解决方案1】:

    查看 Erlang 的文档 here。有一个名为 process_flag(Flag, Option) 的 BIF。

    process_flag(priority, Level)
    % This sets the process priority. Level is an atom. 
    % There are currently four priority levels: low, normal, high, and max. 
    % The default is normal.
    

    【讨论】:

    • 谢谢。我猜你是在生成进程之前使用这个函数的?还是你把它放在你生成的函数中?
    • @atomh33ls 见this question。如果你想改变外面的优先级,有 process_flag/3
    猜你喜欢
    • 2012-03-06
    • 2023-04-08
    • 2021-03-28
    • 1970-01-01
    • 2010-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多