Erlang / Erlang Advanced Interview questions
What is the pg (process groups) module used for?
pg lets multiple processes join a named group, cluster-wide, so a caller can broadcast or fan
out work to every member without tracking individual PIDs itself — unlike global, which
maps one name to exactly one process, pg maps one name to a set of processes.
pg:join(chat_room_42, self()), Members = pg:get_members(chat_room_42), [Pid ! {new_message, Msg} || Pid <- Members].
Typical uses include pub/sub-style fan-out (every subscriber process in a group gets a copy of an event) and
worker pools where any member can pick up a task. It's deliberately simpler than global: it makes
no attempt at strong consistency guarantees during partitions, favoring availability and low overhead, which
fits well for use cases like broadcast messaging where an occasional stale group view is tolerable.
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...
