What determines the lifespan of a star?