Believe it or not, sitting in the middle of that photo is a fully reproductively mature insect (I'm not so sure about the maturity of the other individuals). In fact, it's a fully mature fly. Miastor is a genus of midges found living in rotting wood or fungal fruiting bodies. Members of this genus are found worldwide; I believe that several species are recognised, but distinguishing the individual species is extremely difficult. Miastor exhibit what is called paedogenesis: they can become reproductively mature while still in the larval state. They are not the only genus of the family Cecidomyiidae to exhibit this process; another such genus, Oligarces, is found in similar habitats. Miastor is probably the best known such genus, in part because it has been cultured for study in the laboratory, and in part because of the decidedly macabre way in which its paedogenesis plays out.
Each paedogenetic Miastor larva develops several eggs within its ovaries (generally four to ten or more—Harris 1923). No males are involved in this process: the larvae are parthenogenetic as well as paedogenetic. These eggs hatch while still inside their mother, after which the daughter larvae are nourished by the mother's own tissues. Eventually, the daughters are not born so much as they escape. In the words of Quammen (1985), "While the food lasts, while opportunity endures, no Miastor female can live to adulthood without dying of motherhood". But karma still seems to have its place, because by the time the daughter larvae escape they carry their own fate within them: they emerge with their own eggs already developing inside them.
In this way, a Miastor colony can go through an entire generation in as little time as two weeks, until changing conditions (such as exhaustion of food supplies, or a change in season) induce a change in tack. Larvae are produced that do not reproduce paedogenetically in the way that their mothers did, but instead pupate in the usual way to emerge as more ordinarily formed midges, both males and females. As with another paedogenetic insect that has already been featured on this site, the beetle Micromalthus debilis, these metamorphosing larvae can be readily distinguished from paedogenetic larvae. Not only do they not produce the precocious reproductive organs of their fellows, but they have visible imaginal discs (the clumps of tissue that develop into adult structures during metamorphosis), and have eyes that are clearly separated on top rather than touching as in paedogenetic individuals (Harris 1923). After the mature adult midges emerge from their pupae, they can disperse in search of new habitats, seeking food for their offspring and mates for themselves in order to begin the cycle again.
Harris, R. G. 1923. Occurrence, life-cycle, and maintenance under artificial conditions, of Miastor. Psyche 30 (3–4): 95–101.
Quammen, D. 1985. Natural Acts. Schocken Books.