Organizing the priests into orderly shifts was a fundamental part of the Temple service. To establish a clear working schedule, King David, alongside two senior priests, reorganized the priestly families. The restructuring involved representatives from the two major priestly families: Zadok, representing the descendants of Eleazar, and Ahimelech, representing the descendants of Ithamar. Ahimelech was the son of Abiathar the priest [רש״י, רלב״ג, מלבי״ם]. Because Abiathar had been removed from his position at that time, his son stepped in to represent the family [מלבי״ם]. Tracing Abiathar's lineage back to the house of Eli reveals that Eli's family belonged to the dynasty of Ithamar [רלב״ג]. During this era, the house of Ithamar held the High Priesthood, making the appointment of Zadok as a chief priest alongside Ahimelech a relatively new development [ביאור שטיינזלץ].
The need to reorganize stemmed from a demographic shift. David noticed a growing numerical gap between the families; the descendants of Eleazar had multiplied significantly and now outnumbered the descendants of Ithamar [רד״ק]. To address this, a total of twenty-four priestly shifts were established. The division reflected the population difference, with sixteen shifts assigned to the descendants of Eleazar and eight to the descendants of Ithamar [רלב״ג, רד״ק]. Regarding the historical development of these shifts, there are two main traditions. One perspective suggests that Moses originally established only eight shifts, four for each family, which the prophet Samuel later expanded to sixteen, before David finally set the number at twenty-four. Another view maintains that Moses initially created sixteen shifts, and David and Samuel worked together to increase them to twenty-four [רד״ק].
The ultimate goal of this division was to properly organize the priests according to their numbers and their specific duties [מצודת דוד]. In practice, the work schedule operated on a fixed, repeating cycle. Each of the twenty-four shifts served in the Temple for seven days. To ensure perfect order without any daily disruptions, each shift was further divided into seven sub-families, known as fathers' houses, with each sub-family responsible for serving on one specific day of the week. Once the twenty-fourth shift completed its week of service, the cycle restarted from the beginning. The names of the shift leaders established during David's time became permanent, and the shifts continued to be known by these names for generations to come [רלב״ג].