liveBook · Manning

Process group

As explained in Elixir in Action, Third Edition

A process group is a named cluster-wide collection of processes that can be queried as a set for communication or coordination.

A process group is a named, cluster-wide collection of processes. It lets distributed nodes categorize replicas, discover group members, and broadcast coordination messages across them. section 12.1.3

Using the :pg module follows a small operational workflow:

  • Join processes to an arbitrarily named group with :pg.join/2. section 12.1.3
  • Query membership with :pg.get_members/1, then send requests to every returned process when all replicas must be updated. section 12.1.3

Replicated to-do lists

Place each node's process responsible for Bob's to-do list in {:todo_list, "bob"}. Broadcast updates to every group member so replicas stay synchronized; query one member when reading. section 12.1.3

How Elixir in Action, Third Edition covers it

How deep it goes
Explains startup, joining, membership queries, and update coordination, but stops short of detailed failure semantics.
Examples
Uses two connected nodes, Bob's replicated to-do list, :pg.join/2, and :pg.get_members/1.
What it assumes
Assumes connected Erlang nodes and process identifiers while teaching group startup, membership, and querying.
What you can do after
Apply it via :pg to register distributed replicas, inspect group membership, and broadcast requests across processes.
How it connects
Connects process discovery with distributed systems, replication, fault tolerance, and GenServer coordination.

Also explained in

Compare how 3 books explain process group →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elixir in Action, Third Edition. The section links point to the parts of the book it draws on.