The function of cohesin is to hold sister chromatids together from the time they are replicated in the S phase until they are separated during the anaphase of mitosis or meiosis. This process is regulated by cohesin regulators such as kinases and phosphatases, which modulate the cohesin complex's loading and release dynamics. Additionally, cohesin plays a role in DNA repair by facilitating homologous recombination and maintaining genome stability.