Ruby进程(3) Process.fork 和 Ruby 1.9.2 中的新方法 Process.spawn的区别
简单来说:Process.spawn = Process.fork + exec
Process.fork
allows you to run ruby code in another process. Process.spawn
allows you to run another program in another process. Basically Process.spawn
is like using Process.fork
and then calling exec
in the forked process, except that it gives you more options.
Use fork
if you need to run arbitrary ruby code in a separate process (you can't do that with spawn
). Use spawn
if you need to invoke an application in a subprocess.
Source:
http://stackoverflow.com/questions/4129196/whats-the-difference-between-process-fork-and-process-spawn-in-ruby-1-9-2
相关推荐
PMJ0 2020-10-13
longzhiwen 2020-09-06
yangxingstar 2020-08-31
LUCIEN0 2020-08-17
huangzihao00 2020-08-17
Jan 2020-08-17
AndesStay 2020-06-12
afengxg 2020-06-09
zamesking 2020-06-09
afengxg 2020-06-09
何志文 2020-06-09
teresalxm 2020-06-05
何志文 2020-05-16
何志文 2020-05-11
fsl 2020-05-04
JOO 2020-04-26
倩 2020-04-22
afanti 2020-04-19
始终不够 2020-04-10