A hermit crab's abdomen is soft and coiled to fit inside a gastropod shell, so a well-fitting shell is a survival requirement rather than a preference. Because shells only become available when snails die, and because they wear and break, empty shells of the right size are chronically scarce, and crabs regularly assess and reject candidates by rolling and probing them.
When a shell too large for the finder turns up, crabs assemble around it and form what biologists call a vacancy chain. Individuals queue by body size, holding position until the largest crab that fits enters the new shell. The moment it leaves, the next crab takes the shell it abandoned, and the exchange propagates down the line. The whole sequence can conclude in well under a minute.
The behaviour is a genuine example of a resource cascade, but it is not cooperation in a moral sense. Crabs also fight over shells, evict occupants by rapping their shell against another's, and terrestrial species have been recorded exploring and rejecting artificial containers, which is one reason painted souvenir shells are a poor substitute.
