-module(processes1).
-export([max/1]).
max(N)->
Max=erlang:system_info(process_limit),
io:format(“Maximum allowed processes:pn”,[Max]),
statistics(runtime),
statistics(wall_clock),
L=for(1,N,fun()->spawn(fun()->wait() end)end),
{,Time1}=statistics(runtime),
{,Time2}=statistics(wall_clock),
lists:foreach(fun(Pid)->Pid!die end,L),
U1=Time11000/N,
U2=Time21000/N,
io:format(“Process spawn time=p(p)microseconds~n”,
[U1,U2]).
wait()->
receive
die->void
end.
for(N,N,F)->[F()];
for(I,N,F)->[F()|for(I+1,N,F)].
Erlang程序设计(第2版)【瑞典】Joe Armstrong 著 牛化成译 【M】北京:中国工信出版社和人民邮电出版社
Erlang----进程吞吐量
最新推荐文章于 2024-10-27 17:19:25 发布