Flagella of eukaryotic cells are transient long cylindrical protrusions. The proteins needed to form and maintain flagella are synthesized in the cell body and transported to the distal tips. What `rulers or `timers a specific type of cells use to strike a balance between the outward and inward transport of materials so as to maintain a particular length of its flagella in the steady state is one of the open questions in cellular self-organization. Even more curious is how the two flagella of biflagellates, like Chlamydomonas Reinhardtii, communicate through their base to coordinate their lengths. In this paper we develop a stochastic model for flagellar length control based on a time-of-flight (ToF) mechanism. This ToF mechanism decides whether or not structural proteins are to be loaded onto an intraflagellar transport (IFT) train just before it begins its motorized journey from the base to the tip of the flagellum. Because of the ongoing turnover, the structural proteins released from the flagellar tip are transported back to the cell body also by IFT trains. We represent the traffic of IFT trains as a totally asymmetric simple exclusion process (TASEP). The ToF mechanism for each flagellum, together with the TASEP-based description of the IFT trains, combined with a scenario of sharing of a common pool of flagellar structural proteins in biflagellates, can account for all key features of experimentally known phenomena. These include ciliogenesis, resorption, deflagellation as well as regeneration after selective amputation of one of the two flagella. We also show that the experimental observations of Ishikawa and Marshall are consistent with the ToF mechanism of length control if the effects of the mutual exclusion of the IFT trains captured by the TASEP are taken into account. Moreover, we make new predictions on the flagellar length fluctuations and the role of the common pool.