How is session destroyed when it expires?

How is session destroyed when it expires?
Did Frappe take the initiative to inspect and execute the destruction?
Thanks

You perhaps refer to this session - to grep and trace the code will help answer what you seek?