"And if a Levite comes . . . he may come whenever his soul desires . . . and he may serve in the name of G‑d, his G‑d, just like all his Levite brothers, who stand there before G‑d. They shall eat equal portions..."—Deuteronomy 18:6-8.
We are commanded to divide the kohanim (priests) into shifts, so that each week another shift should serve in the Holy Temple. Only during the festivals shall all the kohanim serve together.
The prophet Samuel and King David divided the kohanim into 24 shifts.