I have a legacy Win32 application written in C++ that runs on the system continuously to monitor system health related parameters. Recently, I started facing an issue with the application getting suspended and becoming unresponsive thereafter on Windows 10 after every 2-3 days. After doing a bit of research, I came to know about a new feature introduced in the recent Windows 10 release that actively looks for processes that are not being actively used and suspends these processes to save system resources like CPU and RAM. While I came across several articles (one of the reference links is this) that state the Windows 10 has a wait time of around 5-10 seconds after which it moves the process to suspended state if the user is not actively using it. Now my application sends a UDP message to a remote server every 30 seconds indicating to the server that the application is running on the machine. Here are the questions that I have:
- Is there a way to prevent the application from being suspended or a way to increase this timeout to a relatively large value so that the application remains active?
- There are other non UI based application also running on my system which are relatively less active but they do not get suspended ever, Is this only applicable to UI based applications?
- While there were some references like this to add a special handling in your application to trap the suspending message from Windows and save the necessary state in your application but all these references are C# based. Can someone point me to a similar reference for C++?
- Is there some way I can track when and why Windows suspended the app in the form of some event logs or Windows logs?
Additional information: I tried to manually suspend/resume the application by using Resource Monitor and Process Explorer as the application does not get suspended instantly to understand the behavior but no luck. I have a feeling that his should be handled in the application itself and because it is not handled currently that the application becomes unresponsive.
Any help with be highly appreciated as I am stuck here for few days.
Thanks in advance!