Typical manual differential lock (Unimog)
Differential locks (when engaged properly) guarantee equal wheel speed on all 4 wheels. Spinning wheels are prevented.
Heavy duty off-road situations ask for three (center differential & front and rear axle differentials) manually and independently lockable differentials. Dog clutches provide the lock up.
They require a trained and experienced driver to operate them properly. Untrained use may cause more harm than good. Improper use on pavement may cause death or injury. Improper use off-road may cause component failure or severe difficulties to maneuver the truck.
Ideally, differentials should be (manually) locked before traction is lost and wheels start spinning.They need to be switched off immediately after passing through a tough off-road section.
Here is how to best use a manual locker.
4WD and differential locks should be used to prevent getting stuck - they might not work to get you out of stuck situations.