i want to know can we detect infinite loop in our programs and yes how to do that.

thanks