- 浏览: 982287 次
- 性别:
- 来自: 广州
最新评论
-
qingchuwudi:
有用,非常感谢!
erlang进程的优先级 -
zfjdiamond:
你好 这条命令 在那里输入??
你们有yum 我有LuaRocks -
simsunny22:
这个是在linux下运行的吧,在window下怎么运行escr ...
escript的高级特性 -
mozhenghua:
http://www.erlang.org/doc/apps/ ...
mnesia 分布协调的几个细节 -
fxltsbl:
A new record of 108000 HTTP req ...
Haproxy 1.4-dev2: barrier of 100k HTTP req/s crossed
Erlang作为一门FP语言,和传统的语言结构一样, 有模块, 有函数, 有语句, 有判断, 有循环, 还有特别的模式匹配。 那么这些在底层是如何运作的。 我在底下给大家做个简单的实验,让大家一窥内部的细节,让大家写码的时候知道个大概。
erlang的VM作为register based的VM, 大概有400条指令.指令分为hot, normal, cold 3大类别。beam_emu.c是vm的实现,hot和cold指令在编译的时候 由脚本生成的,include到beam_emu去的。 hot是热门的操作如list, tuple操作, cold的就是比较偏的指令。
erlang的编译器支持生成汇编码, 让我们的研究成可能,具体用法是 erlc +"'S'" m.erl
会生成m.S 这个汇编文件.
root@nd-desktop:~# cat gram.erl
-module(gram).
-export([start/1]).
start([X])->
%% bif
X1 = list_to_integer(atom_to_list(X)),
%% list
W =[1,2,3],
W1 = [4|W],
K=[W1,9],
%% constant fold
A = 1 + 2,
%% if
B =
if X1 + A > 0 -> 5;
true -> 4
end,
%% case
C =
case B of
{x, T} -> T;
5 -> a1;
3 -> a2;
2 -> 1.0;
other -> 2;
true -> 3
end,
%% receive
D =
receive
a1 ->
2 + 1.2;
2 -> 3;
{tag, N}->N;
a2 -> 5;
_ -> ok
after A ->
timeout
end,
%% anon fun
E = fun (1)-> D;
(x)-> 2;
(y)-> C;
(<<"12">>)->1;
(_) -> error
end,
F = E(D),
%% fun
G = f(B),
io:format("~p~p~p~p~n",[F, G,W,K]),
done.
f(1)-> 1;
f(2) ->2;
f(3) ->3;
f(4) ->4;
f(5) ->5;
f(x1) ->1;
f(x2) ->2;
f(x3) ->3;
f(x4) ->4;
f(x5) ->5;
f({x,1}) -> 1;
f({x,2}) ->2;
f({x,3}) ->3;
f({x,4}) ->4;
f({x,5}) ->5;
f(<<1:8, X:32, "xyz", F/float>>) -> {X, F};
f(_) -> err.
root@nd-desktop:~# erlc +"'S'" gram.erl
root@nd-desktop:~# cat gram.S
{module, gram}. %% version = 0
{exports, [{module_info,0},{module_info,1},{start,1}]}.
{attributes, []}.
{labels, 45}. %%每个标签是跳转地址
%%每个指令对应这相应的opcode,在beam_emu中都可以找到。
{function, start, 1, 2}.
{label,1}.
{func_info,{atom,gram},{atom,start},1}.
{label,2}.
{test,is_nonempty_list,{f,1},[{x,0}]}.
{get_list,{x,0},{x,1},{x,2}}.
{test,is_nil,{f,1},[{x,2}]}.
{allocate_zero,2,2}.
{move,{x,1},{x,0}}.
%% bif调用
{call_ext,1,{extfunc,erlang,atom_to_list,1}}.
{call_ext,1,{extfunc,erlang,list_to_integer,1}}.
%% 符号也是bif
%% 3= 1 +2 const fold
{gc_bif,'+',{f,3},1,[{x,0},{integer,3}],{x,1}}.
%% if 语句是如此简单
{test,is_lt,{f,3},[{integer,0},{x,1}]}.
{move,{integer,5},{x,0}}.
{jump,{f,4}}.
{label,3}.
{move,{integer,4},{x,0}}.
{label,4}.
{move,{x,0},{y,1}}.
%% case语句同样是个if else的判断
%% tuple是如何匹配的 效率高
{test,is_tuple,{f,5},[{x,0}]}.
{test,test_arity,{f,21},[{x,0},2]}.
{get_tuple_element,{x,0},0,{x,1}}.
{get_tuple_element,{x,0},1,{x,2}}.
{test,is_eq_exact,{f,21},[{x,1},{atom,x}]}.
{move,{x,2},{x,0}}.
{jump,{f,12}}.
{label,5}.
{test,is_atom,{f,8},[{x,0}]}.
%% 2分查找
{select_val,{x,0},{f,21},{list,[{atom,true},{f,6},{atom,other},{f,7}]}}.
{label,6}.
{move,{integer,3},{x,0}}.
{jump,{f,12}}.
{label,7}.
{move,{integer,2},{x,0}}.
{jump,{f,12}}.
{label,8}.
{test,is_integer,{f,21},[{x,0}]}.
%% 编译器会聪明的做这类事情
{select_val,{x,0},
{f,21},
{list,[{integer,2},
{f,9},
{integer,3},
{f,10},
{integer,5},
{f,11}]}}.
{label,9}.
{move,{float,1.0},{x,0}}.
{jump,{f,12}}.
{label,10}.
{move,{atom,a2},{x,0}}.
{jump,{f,12}}.
{label,11}.
{move,{atom,a1},{x,0}}.
{label,12}.
{move,{x,0},{y,0}}.
%% receive语句
{label,13}.
{loop_rec,{f,19},{x,0}}.
{test,is_tuple,{f,14},[{x,0}]}.
{test,test_arity,{f,18},[{x,0},2]}.
{get_tuple_element,{x,0},0,{x,1}}.
{get_tuple_element,{x,0},1,{x,2}}.
{test,is_eq_exact,{f,18},[{x,1},{atom,tag}]}.
%%从消息队列移除
remove_message.
{move,{x,2},{x,0}}.
{jump,{f,20}}.
{label,14}.
{test,is_atom,{f,17},[{x,0}]}.
{select_val,{x,0},{f,18},{list,[{atom,a2},{f,15},{atom,a1},{f,16}]}}.
{label,15}.
remove_message.
{move,{integer,5},{x,0}}.
{jump,{f,20}}.
{label,16}.
remove_message.
{move,{float,3.2},{x,0}}.
{jump,{f,20}}.
{label,17}.
{test,is_eq_exact,{f,18},[{x,0},{integer,2}]}.
remove_message.
{move,{integer,3},{x,0}}.
{jump,{f,20}}.
{label,18}.
remove_message.
{move,{atom,ok},{x,0}}.
{jump,{f,20}}.
{label,19}.
%% timeout添加到定时器
{wait_timeout,{f,13},{integer,3}}.
timeout.
{move,{atom,timeout},{x,0}}.
{label,20}.
%% 闭包
{move,{x,0},{x,1}}.
{move,{y,0},{x,0}}.
{move,{x,1},{y,0}}.
{make_fun2,{f,39},0,133275192,2}.
{move,{x,0},{x,1}}.
{move,{y,0},{x,0}}.
{trim,1,1}.
{call_fun,1}.
{move,{x,0},{x,1}}.
{move,{y,0},{x,0}}.
{move,{x,1},{y,0}}.
{call,1,{f,23}}.
{test_heap,4,1}.
%% 列表操作
{put_list,{x,0},{literal,[[1,2,3],[[4,1,2,3],9]]},{x,0}}.
{put_list,{y,0},{x,0},{x,1}}.
{trim,1,0}.
{move,{literal,"~p~p~p~p~n"},{x,0}}.
{call_ext,2,{extfunc,io,format,2}}.
{move,{atom,done},{x,0}}.
{deallocate,0}.
return.
{label,21}.
{case_end,{x,0}}.
{function, f, 1, 23}.
{label,22}.
{func_info,{atom,gram},{atom,f},1}.
{label,23}.
{test,bs_start_match2,{f,24},1,[{x,0},0],{x,0}}.
{test,bs_match_string,{f,33},[{x,0},8,{string,[1]}]}.
{test,bs_get_integer2,
{f,33},
1,
[{x,0},
{integer,32},
1,
{field_flags,[{anno,[78,{file,"./gram.erl"}]},unsigned,big]}],
{x,1}}.
{test,bs_match_string,{f,33},[{x,0},24,{string,"xyz"}]}.
{test,bs_get_float2,
{f,33},
2,
[{x,0},
{integer,64},
1,
{field_flags,[{anno,[78,{file,"./gram.erl"}]},unsigned,big]}],
{x,2}}.
{test,bs_test_tail2,{f,33},[{x,0},0]}.
{test_heap,3,3}.
{put_tuple,2,{x,0}}.
{put,{x,1}}.
{put,{x,2}}.
return.
{label,24}.
{test,is_tuple,{f,25},[{x,0}]}.
{test,test_arity,{f,33},[{x,0},2]}.
{get_tuple_element,{x,0},0,{x,1}}.
{get_tuple_element,{x,0},1,{x,2}}.
{test,is_eq_exact,{f,33},[{x,1},{atom,x}]}.
{test,is_integer,{f,33},[{x,2}]}.
{select_val,{x,2},
{f,33},
{list,[{integer,5},
{f,26},
{integer,4},
{f,27},
{integer,3},
{f,28},
{integer,2},
{f,29},
{integer,1},
{f,30}]}}.
{label,25}.
{test,is_atom,{f,31},[{x,0}]}.
{select_val,{x,0},
{f,33},
{list,[{atom,x5},
{f,26},
{atom,x4},
{f,27},
{atom,x3},
{f,28},
{atom,x2},
{f,29},
{atom,x1},
{f,30}]}}.
{label,26}.
{move,{integer,5},{x,0}}.
return.
{label,27}.
{move,{integer,4},{x,0}}.
return.
{label,28}.
{move,{integer,3},{x,0}}.
return.
{label,29}.
{move,{integer,2},{x,0}}.
return.
{label,30}.
{move,{integer,1},{x,0}}.
return.
{label,31}.
{test,is_integer,{f,33},[{x,0}]}.
{select_val,{x,0},
{f,33},
{list,[{integer,5},
{f,32},
{integer,4},
{f,32},
{integer,3},
{f,32},
{integer,2},
{f,32},
{integer,1},
{f,32}]}}.
{label,32}.
return.
{label,33}.
{move,{atom,err},{x,0}}.
return.
%%这2个函数是complier要硬性加上去的
{function, module_info, 0, 35}.
{label,34}.
{func_info,{atom,gram},{atom,module_info},0}.
{label,35}.
{move,{atom,gram},{x,0}}.
{call_ext_only,1,{extfunc,erlang,get_module_info,1}}.
{function, module_info, 1, 37}.
{label,36}.
{func_info,{atom,gram},{atom,module_info},1}.
{label,37}.
{move,{x,0},{x,1}}.
{move,{atom,gram},{x,0}}.
{call_ext_only,2,{extfunc,erlang,get_module_info,2}}.
%%匿名函数的命名
{function, '-start/1-fun-0-', 3, 39}.
{label,38}.
{func_info,{atom,gram},{atom,'-start/1-fun-0-'},3}.
{label,39}.
{test,bs_start_match2,{f,40},3,[{x,0},0],{x,0}}.
{test,bs_match_string,{f,44},[{x,0},16,{string,"12"}]}.
{test,bs_test_tail2,{f,44},[{x,0},0]}.
%% bitstring的代码很优化。
{move,{integer,1},{x,0}}.
return.
{label,40}.
{test,is_atom,{f,43},[{x,0}]}.
{select_val,{x,0},{f,44},{list,[{atom,y},{f,41},{atom,x},{f,42}]}}.
%% 一类的数据放在一起 用二分查找匹配
{label,41}.
{move,{x,1},{x,0}}.
return.
{label,42}.
{move,{integer,2},{x,0}}.
return.
{label,43}.
{test,is_eq_exact,{f,44},[{x,0},{integer,1}]}.
{move,{x,2},{x,0}}.
return.
{label,44}.
{move,{atom,error},{x,0}}.
return.
所以无论函数match, 表达式match在vm层面都是if else这样的判断。从这个角度来讲if, case这些都只是erlang的语法糖。事实上也是,这些语法都是后来添加的,取悦用户的。
函数匹配是erlang的所有事情的核心。
结论:erlang的compiler很智能,这个VM和lua的非常像, 效率也相当。
erlang的VM作为register based的VM, 大概有400条指令.指令分为hot, normal, cold 3大类别。beam_emu.c是vm的实现,hot和cold指令在编译的时候 由脚本生成的,include到beam_emu去的。 hot是热门的操作如list, tuple操作, cold的就是比较偏的指令。
erlang的编译器支持生成汇编码, 让我们的研究成可能,具体用法是 erlc +"'S'" m.erl
会生成m.S 这个汇编文件.
root@nd-desktop:~# cat gram.erl
-module(gram).
-export([start/1]).
start([X])->
%% bif
X1 = list_to_integer(atom_to_list(X)),
%% list
W =[1,2,3],
W1 = [4|W],
K=[W1,9],
%% constant fold
A = 1 + 2,
%% if
B =
if X1 + A > 0 -> 5;
true -> 4
end,
%% case
C =
case B of
{x, T} -> T;
5 -> a1;
3 -> a2;
2 -> 1.0;
other -> 2;
true -> 3
end,
%% receive
D =
receive
a1 ->
2 + 1.2;
2 -> 3;
{tag, N}->N;
a2 -> 5;
_ -> ok
after A ->
timeout
end,
%% anon fun
E = fun (1)-> D;
(x)-> 2;
(y)-> C;
(<<"12">>)->1;
(_) -> error
end,
F = E(D),
%% fun
G = f(B),
io:format("~p~p~p~p~n",[F, G,W,K]),
done.
f(1)-> 1;
f(2) ->2;
f(3) ->3;
f(4) ->4;
f(5) ->5;
f(x1) ->1;
f(x2) ->2;
f(x3) ->3;
f(x4) ->4;
f(x5) ->5;
f({x,1}) -> 1;
f({x,2}) ->2;
f({x,3}) ->3;
f({x,4}) ->4;
f({x,5}) ->5;
f(<<1:8, X:32, "xyz", F/float>>) -> {X, F};
f(_) -> err.
root@nd-desktop:~# erlc +"'S'" gram.erl
root@nd-desktop:~# cat gram.S
{module, gram}. %% version = 0
{exports, [{module_info,0},{module_info,1},{start,1}]}.
{attributes, []}.
{labels, 45}. %%每个标签是跳转地址
%%每个指令对应这相应的opcode,在beam_emu中都可以找到。
{function, start, 1, 2}.
{label,1}.
{func_info,{atom,gram},{atom,start},1}.
{label,2}.
{test,is_nonempty_list,{f,1},[{x,0}]}.
{get_list,{x,0},{x,1},{x,2}}.
{test,is_nil,{f,1},[{x,2}]}.
{allocate_zero,2,2}.
{move,{x,1},{x,0}}.
%% bif调用
{call_ext,1,{extfunc,erlang,atom_to_list,1}}.
{call_ext,1,{extfunc,erlang,list_to_integer,1}}.
%% 符号也是bif
%% 3= 1 +2 const fold
{gc_bif,'+',{f,3},1,[{x,0},{integer,3}],{x,1}}.
%% if 语句是如此简单
{test,is_lt,{f,3},[{integer,0},{x,1}]}.
{move,{integer,5},{x,0}}.
{jump,{f,4}}.
{label,3}.
{move,{integer,4},{x,0}}.
{label,4}.
{move,{x,0},{y,1}}.
%% case语句同样是个if else的判断
%% tuple是如何匹配的 效率高
{test,is_tuple,{f,5},[{x,0}]}.
{test,test_arity,{f,21},[{x,0},2]}.
{get_tuple_element,{x,0},0,{x,1}}.
{get_tuple_element,{x,0},1,{x,2}}.
{test,is_eq_exact,{f,21},[{x,1},{atom,x}]}.
{move,{x,2},{x,0}}.
{jump,{f,12}}.
{label,5}.
{test,is_atom,{f,8},[{x,0}]}.
%% 2分查找
{select_val,{x,0},{f,21},{list,[{atom,true},{f,6},{atom,other},{f,7}]}}.
{label,6}.
{move,{integer,3},{x,0}}.
{jump,{f,12}}.
{label,7}.
{move,{integer,2},{x,0}}.
{jump,{f,12}}.
{label,8}.
{test,is_integer,{f,21},[{x,0}]}.
%% 编译器会聪明的做这类事情
{select_val,{x,0},
{f,21},
{list,[{integer,2},
{f,9},
{integer,3},
{f,10},
{integer,5},
{f,11}]}}.
{label,9}.
{move,{float,1.0},{x,0}}.
{jump,{f,12}}.
{label,10}.
{move,{atom,a2},{x,0}}.
{jump,{f,12}}.
{label,11}.
{move,{atom,a1},{x,0}}.
{label,12}.
{move,{x,0},{y,0}}.
%% receive语句
{label,13}.
{loop_rec,{f,19},{x,0}}.
{test,is_tuple,{f,14},[{x,0}]}.
{test,test_arity,{f,18},[{x,0},2]}.
{get_tuple_element,{x,0},0,{x,1}}.
{get_tuple_element,{x,0},1,{x,2}}.
{test,is_eq_exact,{f,18},[{x,1},{atom,tag}]}.
%%从消息队列移除
remove_message.
{move,{x,2},{x,0}}.
{jump,{f,20}}.
{label,14}.
{test,is_atom,{f,17},[{x,0}]}.
{select_val,{x,0},{f,18},{list,[{atom,a2},{f,15},{atom,a1},{f,16}]}}.
{label,15}.
remove_message.
{move,{integer,5},{x,0}}.
{jump,{f,20}}.
{label,16}.
remove_message.
{move,{float,3.2},{x,0}}.
{jump,{f,20}}.
{label,17}.
{test,is_eq_exact,{f,18},[{x,0},{integer,2}]}.
remove_message.
{move,{integer,3},{x,0}}.
{jump,{f,20}}.
{label,18}.
remove_message.
{move,{atom,ok},{x,0}}.
{jump,{f,20}}.
{label,19}.
%% timeout添加到定时器
{wait_timeout,{f,13},{integer,3}}.
timeout.
{move,{atom,timeout},{x,0}}.
{label,20}.
%% 闭包
{move,{x,0},{x,1}}.
{move,{y,0},{x,0}}.
{move,{x,1},{y,0}}.
{make_fun2,{f,39},0,133275192,2}.
{move,{x,0},{x,1}}.
{move,{y,0},{x,0}}.
{trim,1,1}.
{call_fun,1}.
{move,{x,0},{x,1}}.
{move,{y,0},{x,0}}.
{move,{x,1},{y,0}}.
{call,1,{f,23}}.
{test_heap,4,1}.
%% 列表操作
{put_list,{x,0},{literal,[[1,2,3],[[4,1,2,3],9]]},{x,0}}.
{put_list,{y,0},{x,0},{x,1}}.
{trim,1,0}.
{move,{literal,"~p~p~p~p~n"},{x,0}}.
{call_ext,2,{extfunc,io,format,2}}.
{move,{atom,done},{x,0}}.
{deallocate,0}.
return.
{label,21}.
{case_end,{x,0}}.
{function, f, 1, 23}.
{label,22}.
{func_info,{atom,gram},{atom,f},1}.
{label,23}.
{test,bs_start_match2,{f,24},1,[{x,0},0],{x,0}}.
{test,bs_match_string,{f,33},[{x,0},8,{string,[1]}]}.
{test,bs_get_integer2,
{f,33},
1,
[{x,0},
{integer,32},
1,
{field_flags,[{anno,[78,{file,"./gram.erl"}]},unsigned,big]}],
{x,1}}.
{test,bs_match_string,{f,33},[{x,0},24,{string,"xyz"}]}.
{test,bs_get_float2,
{f,33},
2,
[{x,0},
{integer,64},
1,
{field_flags,[{anno,[78,{file,"./gram.erl"}]},unsigned,big]}],
{x,2}}.
{test,bs_test_tail2,{f,33},[{x,0},0]}.
{test_heap,3,3}.
{put_tuple,2,{x,0}}.
{put,{x,1}}.
{put,{x,2}}.
return.
{label,24}.
{test,is_tuple,{f,25},[{x,0}]}.
{test,test_arity,{f,33},[{x,0},2]}.
{get_tuple_element,{x,0},0,{x,1}}.
{get_tuple_element,{x,0},1,{x,2}}.
{test,is_eq_exact,{f,33},[{x,1},{atom,x}]}.
{test,is_integer,{f,33},[{x,2}]}.
{select_val,{x,2},
{f,33},
{list,[{integer,5},
{f,26},
{integer,4},
{f,27},
{integer,3},
{f,28},
{integer,2},
{f,29},
{integer,1},
{f,30}]}}.
{label,25}.
{test,is_atom,{f,31},[{x,0}]}.
{select_val,{x,0},
{f,33},
{list,[{atom,x5},
{f,26},
{atom,x4},
{f,27},
{atom,x3},
{f,28},
{atom,x2},
{f,29},
{atom,x1},
{f,30}]}}.
{label,26}.
{move,{integer,5},{x,0}}.
return.
{label,27}.
{move,{integer,4},{x,0}}.
return.
{label,28}.
{move,{integer,3},{x,0}}.
return.
{label,29}.
{move,{integer,2},{x,0}}.
return.
{label,30}.
{move,{integer,1},{x,0}}.
return.
{label,31}.
{test,is_integer,{f,33},[{x,0}]}.
{select_val,{x,0},
{f,33},
{list,[{integer,5},
{f,32},
{integer,4},
{f,32},
{integer,3},
{f,32},
{integer,2},
{f,32},
{integer,1},
{f,32}]}}.
{label,32}.
return.
{label,33}.
{move,{atom,err},{x,0}}.
return.
%%这2个函数是complier要硬性加上去的
{function, module_info, 0, 35}.
{label,34}.
{func_info,{atom,gram},{atom,module_info},0}.
{label,35}.
{move,{atom,gram},{x,0}}.
{call_ext_only,1,{extfunc,erlang,get_module_info,1}}.
{function, module_info, 1, 37}.
{label,36}.
{func_info,{atom,gram},{atom,module_info},1}.
{label,37}.
{move,{x,0},{x,1}}.
{move,{atom,gram},{x,0}}.
{call_ext_only,2,{extfunc,erlang,get_module_info,2}}.
%%匿名函数的命名
{function, '-start/1-fun-0-', 3, 39}.
{label,38}.
{func_info,{atom,gram},{atom,'-start/1-fun-0-'},3}.
{label,39}.
{test,bs_start_match2,{f,40},3,[{x,0},0],{x,0}}.
{test,bs_match_string,{f,44},[{x,0},16,{string,"12"}]}.
{test,bs_test_tail2,{f,44},[{x,0},0]}.
%% bitstring的代码很优化。
{move,{integer,1},{x,0}}.
return.
{label,40}.
{test,is_atom,{f,43},[{x,0}]}.
{select_val,{x,0},{f,44},{list,[{atom,y},{f,41},{atom,x},{f,42}]}}.
%% 一类的数据放在一起 用二分查找匹配
{label,41}.
{move,{x,1},{x,0}}.
return.
{label,42}.
{move,{integer,2},{x,0}}.
return.
{label,43}.
{test,is_eq_exact,{f,44},[{x,0},{integer,1}]}.
{move,{x,2},{x,0}}.
return.
{label,44}.
{move,{atom,error},{x,0}}.
return.
所以无论函数match, 表达式match在vm层面都是if else这样的判断。从这个角度来讲if, case这些都只是erlang的语法糖。事实上也是,这些语法都是后来添加的,取悦用户的。
函数匹配是erlang的所有事情的核心。
结论:erlang的compiler很智能,这个VM和lua的非常像, 效率也相当。
评论
3 楼
litaocheng
2009-09-23
yeah,这个东东要好好的看了,好漫长哈。
2 楼
mryufeng
2009-09-21
opcode都长的差不多 明白了lua这个一看也就明白了
1 楼
joshzhu
2009-09-21
哇,好有料
发表评论
-
OTP R14A今天发布了
2010-06-17 14:36 2677以下是这次发布的亮点,没有太大的性能改进, 主要是修理了很多B ... -
R14A实现了EEP31,添加了binary模块
2010-05-21 15:15 3030Erlang的binary数据结构非常强大,而且偏向底层,在作 ... -
如何查看节点的可用句柄数目和已用句柄数
2010-04-08 03:31 4814很多同学在使用erlang的过程中, 碰到了很奇怪的问题, 后 ... -
获取Erlang系统信息的代码片段
2010-04-06 21:49 3475从lib/megaco/src/tcp/megaco_tcp_ ... -
iolist跟list有什么区别?
2010-04-06 20:30 6529看到erlang-china.org上有个 ... -
erlang:send_after和erlang:start_timer的使用解释
2010-04-06 18:31 8386前段时间arksea 同学提出这个问题, 因为文档里面写的很不 ... -
Latest news from the Erlang/OTP team at Ericsson 2010
2010-04-05 19:23 2013参考Talk http://www.erlang-factor ... -
对try 异常 运行的疑问,为什么出现两种结果
2010-04-05 19:22 2842郎咸武<langxianzhe@163.com> ... -
Erlang ERTS Async基础设施
2010-03-19 00:03 2517其实Erts的Async做的很不错的, 相当的完备, 性能又高 ... -
CloudI 0.0.9 Released, A Cloud as an Interface
2010-03-09 22:32 2476基于Erlang的云平台 看了下代码 质量还是不错的 完成了不 ... -
Memory matters - even in Erlang (再次说明了了解内存如何工作的必要性)
2010-03-09 20:26 3439原文地址:http://www.lshift.net/blog ... -
Some simple examples of using Erlang’s XPath implementation
2010-03-08 23:30 2050原文地址 http://www.lshift.net/blog ... -
lcnt 环境搭建
2010-02-26 16:19 2614抄书:otp_doc_html_R13B04/lib/tool ... -
Erlang强大的代码重构工具 tidier
2010-02-25 16:22 2486Jan 29, 2010 We are very happy ... -
[Feb 24 2010] Erlang/OTP R13B04 has been released
2010-02-25 00:31 1387Erlang/OTP R13B04 has been rele ... -
R13B04 Installation
2010-01-28 10:28 1390R13B04后erlang的源码编译为了考虑移植性,就改变了编 ... -
Running tests
2010-01-19 14:51 1486R13B03以后 OTP的模块加入了大量的测试模块,这些模块都 ... -
R13B04在细化Binary heap
2010-01-14 15:11 1508从github otp的更新日志可以清楚的看到otp R13B ... -
R13B03 binary vheap有助减少binary内存压力
2009-11-29 16:07 1668R13B03 binary vheap有助减少binary内存 ... -
erl_nif 扩展erlang的另外一种方法
2009-11-26 01:02 3218我们知道扩展erl有2种方法, driver和port. 这2 ...
相关推荐
8. **熟悉Erlang语言**:为了更好地利用这个语法包,你需要了解Erlang的基础语法,包括函数定义、模块结构、模式匹配等概念。 9. **提升编辑体验**:除了语法高亮,EditPlus还支持代码折叠、自动完成等功能,通过...
- Erlang 22.x版本默认禁用了TLSv1.0和TLSv1.1,这可能会对某些旧的客户端连接造成影响,需要确保系统支持更新的TLS版本。 **3. 不再支持的Erlang版本:** - 从RabbitMQ 3.7.14到3.7.18,Erlang 19.x的支持被终止...
在IT领域,消息队列(Message Queue)是分布式系统中重要...完成这些步骤后,你就可以开始利用RabbitMQ构建高可用、高性能的分布式系统了。记得定期更新RabbitMQ和Erlang到最新稳定版本,以获取最新的特性和安全修复。
Erlang的性能定量分析涉及对VM行为的深入研究,包括内存使用、进程调度以及垃圾回收(GC)等方面的性能指标。这涉及到监控ERTS的运行时参数,例如ETS(Erlang Term Storage)使用的内存、进程的数量和状态,以及SMP...
4. **编译器更新**:Erlang的BEAM虚拟机编译器进行了改进,代码生成更优化,执行效率更高。 5. **Unicode支持**:加强了Unicode字符串处理,使得处理多语言文本更为便捷。 RabbitMQ 3.7版本主要特性包括: 1. **高...
在安装时,你需要查阅RabbitMQ官方文档以获取最新的版本对应信息,确保你的Erlang安装符合要求。 **RabbitMQ 3.9特性** RabbitMQ 3.9版本带来了许多新特性和改进。其中可能包括性能优化、新的管理插件功能、更好的...
对于开发者而言,理解Erlang的源码可以帮助他们更好地利用这个平台,实现更高效、更健壮的应用程序。 在使用Erlang进行开发时,你可能需要用到以下工具和概念: - **Rebar3**:Erlang的构建和依赖管理工具,帮助你...
**Erlang深度分析** Erlang是一种面向并发的、函数式编程语言,由瑞典电信设备制造商Ericsson..."更多Erlang资料下载.txt"可能是其他相关资源的链接列表,你可以通过这个文件获取更多学习材料,进一步提升Erlang技能。
- **概念**: 通过对Erlang标准库的深入研究,理解其内部实现原理。 - **方法**: - **源代码阅读**: 阅读Erlang标准库的源代码。 - **调试**: 使用调试工具逐步跟踪函数调用过程。 #### 25. Erlang测试案例编写 - ...
rabbitmq3.7.25及对应版本erlang源码包 linux离线安装 安装教程: linux 离线安装rabbitMQ和Erlang https://blog.csdn.net/qq_31366199/article/details/135296148?spm=1001.2014.3001.5502
函数式编程强调数据不可变性和函数的数学属性,使代码更易于理解、测试和并行处理。 ### 2. 并发与轻量级进程 Erlang的一大亮点是其内置的并发机制。它使用轻量级进程(Lightweight Processes, LWP)来实现并发,...
Erlang是一种面向并发的、函数式编程语言,由瑞典...这两本书结合阅读,将为初学者提供一个全面的Erlang学习路径,从基础语法到高级并发编程技巧,有助于深入理解Erlang语言及其在构建高并发、分布式系统中的强大能力。
深入理解分布协议有助于更好地把握Erlang的分布式特性以及在不同环境下部署Erlang应用时可能出现的问题。 #### 2. 性能与优化 ##### 2.1 性能的定量分析 性能定量分析是软件开发中至关重要的部分,尤其是在构建高...
6. **完全免费**:对个人和商业用户都免费,无任何使用限制,这使得更多的人能够接触到Erlang开发并提高生产力。 在提供的压缩包文件“ErlangIDE”中,包含了二郎助手的安装程序或者源代码。通过安装这个工具,...
1. **理解基本语法**:通过解决课后习题,学习者可以熟悉Erlang的基本语法,如变量、函数定义、模式匹配、列表操作等。 2. **掌握并发编程**:习题可能包含创建和管理Erlang进程、实现进程间的消息传递,帮助学习者...
书中会详细解释Erlang的语法和编程范式,让读者理解其独特的函数式编程风格。同时,它也会涉及Erlang的并发特性和错误处理机制,使读者能够编写出可扩展且容错性强的代码。此外,这本书还会讨论Erlang的模块系统、...
1. **语言增强**:Erlang22可能引入了新的语言特性,如更丰富的语法支持或者对现有特性的优化,以便提高开发效率和代码的可读性。 2. **性能提升**:新版本通常会针对CPU使用率、内存管理或垃圾回收进行优化,从而...
- **实践项目**: 结合实际案例进行练习,比如实现一个简单的 Web 服务器或聊天应用,通过实践加深对 Erlang 特性的理解。 - **社区交流**: 加入 Erlang 社区,与其他开发者交流经验和技术问题,参与开源项目也是提高...
版本24.3.4.4是Erlang的一个更新版本,包含了对先前版本的改进和修复。Erlang以其强大的错误恢复能力和轻量级进程(称为Erlang进程)而闻名,这些进程具有内置的并发性和容错性。 在安装Erlang 24.3.4.4之前,首先...