Understanding how natural selection emerges from demographic differences, and in turn how it modifies population dynamics, is a major question in evolutionary ecology. Selection depends on relative fitness in competition, but measuring the latter experimentally is technically challenging. Absolute fitness of genotypes in isolation is more straightforward to measure, but it is unclear to what extent it can predict the outcome of competition. On the other hand, finding similar population dynamics in isolation and in competition may help disentangle the ecological causes and consequences of selection, especially when demographic responses to the environment are complex. Here, we undertake such an approach in the context of programmed cell death (PCD) in the microalga Dunalliela salina. Closely related strains of this species have contrasted demographic responses to hyper-osmotic shock. One undergoes massive PCD-induced population decline followed by demographic rebound, while the other grows continuously, but more slowly. To understand whether and how selection may favour PCD, we exposed monocultures and mixtures of these strains to multiple cycles of hyper-osmotic stress (5 cycles for monocultures, 13 cycles ~180 generations for mixtures), and tracked demography and selection throughout. The declining strain, despite fluctuating substantially in frequency within each cycle, reached a stable frequency across cycles, leading to long-term coexistence. We showed that density dependence near carrying capacity largely explained the stable frequency across cycles, regardless of the initial decline-rebound dynamics. Population dynamics were largely consistent in mixtures and monocultures, suggesting that selection on PCD does not involve strong ecological interactions among strains, contrary to simple expectations.