C# - How to know when Windows is "settled" after startup? C# - How to know when Windows is "settled" after startup? windows windows

C# - How to know when Windows is "settled" after startup?


A 'longish' timer is the best route. I wouldn't touch the registry with a bargepole.

One thing you will want to consider though is what happens if a user wants to launch your program themselves? Obviously you don't want to be causing the delay then.

I assume your application has a UI? If not, you could consider a Service with its start type set to "Automatic (Delayed)" on Vista/7

Please also see this related question: How to create delay startup application in c#?

A final point, if your program is non-critical, and you are worried it might slow things down, consider lowering the priority of the application.


It seems this is the type of thing best left in the hands of the user, and Windows already offers a good option to control this, at least for Windows Services.

If this is a Windows Service, the service can be configured to start Automatic (Delayed Start)

Perhaps that is the best option?

If you don't want to go that route, or if your program is not a Windows Service, detecting when Windows is "settled" is quite subjective and error prone. You could monitor Disk IO as a somewhat reliable indicator. Disk IO is typically the bottleneck during startup (especially for systems without SSD OS drives). You might get a reasonable approximation of "settledness" waiting for the Disk IO (as indicated by performance counters) to drop below a certain threshold. You would want to wait no longer than a configurable amount of time and then start anyhow, because some systems may boot and start performing unrelated, long-running tasks that tax the IO subsystem.


Two suggestions:

  1. Use a low-priority thread to do your work. After all, it's a low priority, right? This alone has a good chance of successfully minimizing the start-up impact.
  2. If you really want to wait for things to settle - just check the processor & memory utilization rather than doing all that registry reading or waiting for an arbitrary amount of time. Instructions on that are here: How to get the CPU Usage in C#?

Good luck!