otp - In Erlang, what's the difference between gen_server:start() and gen_server:start_link()? -
can explain what's difference between gen_server:start()
, gen_server:start_link()
?
i've been told it's multi threading stuff.
edit: if gen_server called multiple threads, execute them @ once ? or create concurrency between these threads?
both functions start new gen_server
instances children of calling process, differ in gen_server:start_link/3,4
atomically starts gen_server
child , links parent process. linking means if child dies, parent default die. supervisors parent processes use links take specific actions when child processes exit abnormally, typically restarting them.
other linking involved in gen_server:start_link
case, there no multi-process aspects involved in these calls. regardless of whether use gen_server:start
or gen_server:start_link
start new gen_server
, new process has single message queue, , receives , processes messages 1 @ time. there nothing gen_server:start_link
causes new gen_server
process behave or perform differently if started gen_server:start
.
Comments
Post a Comment