The ball tracking module manages the locations of all of the pinballs in the machine. It is implemented in common/device.c and uses container declarations in the machine description.
A device is defined to be something which can hold and release pinballs. (Earlier versions of the software used the term container.) A device is comprised of one or more switches which count the number of balls in the device, plus a release solenoid that can be pulsed to force one ball to be removed.
Ball troughs, kickouts, poppers, saucers, and locks are all just different shapes that a device can take. Some containers only hold one ball, while others can hold many.