Erlang / Erlang Advanced Interview questions
What is rpc:call/4 and how does it work across distributed nodes?
rpc:call(Node, Module, Function, Args) lets one node synchronously invoke a function on
another connected node and get the result back, wrapping the underlying message-passing machinery so it looks
like an ordinary function call.
Result = rpc:call('nodeb@host', lists, sort, [[3,1,2]]). %% Result = [1,2,3], computed on nodeb and returned to the caller
Under the hood, the local rpc server sends a request to its counterpart on the remote node,
which spawns a process to execute Module:Function(Args) there and sends the result back; the
caller blocks (with an optional timeout) waiting for that reply, similar in spirit to
gen_server:call but targeting an arbitrary function rather than a specific process's callback.
Because it executes arbitrary code on the remote node, it inherits the same trust model as the rest of
distributed Erlang — any connected, cookie-authenticated node can run arbitrary functions on any other.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
