Erlang / Erlang Advanced Interview questions
How does the global module handle process name registration across a cluster?
The global module extends Erlang's local process registry (register/2) across an
entire distributed cluster: global:register_name/2 makes a PID discoverable by name from any
connected node, not just the one it was spawned on.
global:register_name(payment_processor, self()), %% from any node in the cluster: Pid = global:whereis_name(payment_processor).
To keep the name table consistent across nodes, global synchronizes registrations between all
connected nodes and resolves simultaneous registration conflicts (two nodes registering the same name at
nearly the same time) by calling a configurable resolver function, defaulting to keeping whichever registration
happened first and killing the later, conflicting one. This synchronization has a real cost: registering or
looking up global names is significantly slower than local register/2, since it may require
cluster-wide coordination.
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...
