Thank you for the opportunity to help you with your question!
Gametogenesis, the production of sperm (spermatogenesis) and eggs (oogenesis), takes place through the process of meiosis.
In oogenesis, diploid oogonium go through mitosis until one develops into a primary oocyte, which will begin the first meiotic division, but then arrest; it will finish this division as it develops in the follicle, giving rise to a haploid secondary oocyte and a smaller polar body.The secondary oocyte begins the second meiotic division and then arrests again; it will not finish this division unless it is fertilized by a sperm; if this occurs, a mature ovum and another polar body is produced.
In spermatogenesis, diploid spermatogonia go through mitosis until they begin to develop into gametes; eventually, one develops into a primary spermatocyte that will go through the first meiotic division to form two haploid secondary spermatocytes. The secondary spermatocytes will go through a second meiotic division to each produce two spermatids; these cells will eventually develop flagella and become mature sperm.
Please let me know if you need any clarification. I'm always happy to answer your questions.