The main purpose of PIM is to dynamically construct and maintain efficient multicast routing trees. These trees maintain the state for multicast sources (S, the IP address of the source) and groups (G, the multicast group represented as a multicast IP address) in (S, G) entries; hence, the source tree is often referred to as the (S, G) state. These routing trees control the distribution of multicast traffic through the network and so are called distribution trees.
Multicast distribution trees define how multicast packets are forwarded from a source to all receivers. PIM constructs these multicast distribution trees by referencing unicast routing to the determine Reverse Path Forwarding (RPF) upstream routers along the path from a receiver to a sender. This creates optimal paths, avoids routing loops and can change as network topology changes.
Multicast distribution trees map a multicast source to multicast groups. PIM uses the existing unicast routing able to find the best path from receivers back to the source. They then forward traffic down appropriate paths by using the distribution tree to avoid routing loops.
PIM uses two types of multicast distribution trees: source distribution trees and shared distribution trees.