A small doubt
I have an application(exe) running in infinite loop, how long it executes.. I mean does it executes for years if my system is ON. or is there any timing limit for an application to run.
(If this is not correct place for this question please point me to the correct reference)
If you application is running in an infinite loop, i.e.
It will stop if an error is encountered and not handled correctly by your code, but otherwise it should run indefinitely.
It will terminate if there is an operating system related signal to kill the process. This may come from a user manually trying to kill the process, or it might occur because of a general memory shortage on the system. These types of operating system signal are generally out of your control. However, you can implement a method to detect if your process has been terminated (perhaps by using a daughter process) that will restart/resume the process should it be terminated unexpectedly.
If you add the process(es) to the startup script of your operating system, then you are also covered even in the event of a power failure or other type of event that may cause a reboot.