Simulation distance

Simulation distance is a world-creation setting $$ that controls mob spawning and despawning, and tick updates. As of Java Edition 1.18, simulation distance was introduced as a video setting related to render distance, to restrict tick update distance.

Control
The simulation distance control appears in the settings page when creating a new world. The values that can be set range from 4 to 12 in increments of 2 (even numbers only).

Tick updates
Simulation distance determines the maximum chunk distance in which entities get updated, and blocks and fluids are ticked. This is not a Euclidean distance, but taxicab distance in Bedrock Edition.

Spawning and despawning
Simulation distance restricts the maximum distance at which mobs spawn and despawn.

The minimum spawning distance is 24 blocks (Euclidean distance) from the player. The maximum spawning distance and despawning distances are determined by the simulation distance, which is a quasi-spherical shell having the following ranges relative to the player:

Within the simulation distance, there is a $11/2000$ chance of the mob spawning algorithm attempting to run per chunk, per tick.

Realms supports only a simulation distance of 4.

Regardless of simulation distance, mobs with persistence do not despawn, and fish always despawn when they are more than 40 blocks from the nearest player.

Mob cap
Mobs in chunks outside a ticking area still count toward the per-mob population control caps as long as they were previously loaded within the simulation distance at some time.

Java Edition
In Java Edition, the minimum value of simulation distance is 5. The maximum value is the same as for render distance: 32 for 64-bit Java installs with at least 1 gigabyte of memory, and 16 in all other cases. If render distance is set to a lower value than simulation distance, the lower value is used instead.

Simulation distance defines a square region of chunks around the player where entities are ticked. Using distance of 6 for instance, entities move normally within a 13x13 chunk column around the player chunk. One more chunk out, within a one-chunk-thick square frame surrounding this region, redstone still runs, fluids flow, and crops grow (subject to normal chunk ticking rules). Mobs can still spawn inside this frame region, but since they are not ticked, they do not move or despawn naturally, even though they still contribute to the mob cap. However, even outside entity-ticking chunks they will still despawn if the player moves outside 128 block spherical distance.

Custom Minecraft server software may change these rules, such as making entity-ticking chunks a circular region and not a square.