I developed a Windows software about an year ago. Part of it was to monitor few configuration files for manual changes by user and if any of these change restart a particular service.So, I used the simplest approach. I load them as a string in memory and after few seconds, I read the latest file and compare it with the one in memory. Since, the files are very small (less than 500KB), the program doesn't consume much memory.I am using that application since it is developed and have not experienced any performance problem due to that. But, few days ago I noticed that the program ranks at highest for I/O Read Bytes in task manager. After few hours of uptime of PC, the I/O Read Bytes by this program become significant higher than the rest of processes.So, My question is should I worry about high value of I/O Read Bytes. Is this have some downside effect (maybe on Hard Disk) that I am missing. Is implementing the functionality of monitoring file changes using Windows API have some benefits that are worth the effort required to implement it?
Advantage of monitoring file change using Windows API rather than manually
performance;windows;memory;file handling
I'm not surprised, every few seconds you open a file, and read the contents. Repeat forever keeping your disk from sleeping.The file notification APIs are very easy to use, make the call to set things up and then simply wait for your callback to be called. When you get the callback, you know something has modified the file, so then you read the contents as you do now. The only thing you have to lose is the busy-polling!