Padmanabhan's discussion of dynamics mentions that in general the two dimensional harmonic oscillator fills the surface of a two torus.

He further notes that there will be an extra isolating integral of motion provided that the ratio of frequencies is a rational number.

This last part is not still clear to me.

Can someone please explain why a rational ratio of frequencies make a candidate integral of motion single valued and therefore the motion takes place on a closed (one dimensional) curve on the surface of the two torus?

My confusion was that in the case of a rational ratio, even though periodic, we have still multiple (finitely) values and not a single valued variable.

Turns out that like the nth root of unity in complex plane we can define a single valued function over a multiple (finitely) valued variable. And therefore in the case of a rational ratio we have a new isolating integral of motion which limits the dimension of phase space to just one instead of four.

Clearly in the case of the irrational ration you cannot have a periodic valued variable and therefore the phase space dynamic covers the whole surface of the two torus.