views:

131

answers:

1

We use employees' desktops for CPU-intensive simulation during the night. Desktops run Windows - usually Windows XP. Employees don't log off, they just lock the desktops, switch off their monitors and go.

Every employee has a configuration file which he can edit to specify when he is most likely out of office. When that time comes a background program grabs data for simulation from the server, spawns worker processes, watches them, gets results and sends them to the server. When the time specified by the employee elapses simulation stops so that normal desktop usage is not interfered.

The problem is that simuation consumes a lot of memory, so when the worker processes run they force other programs into the swap file. So when the employee comes all the programs he left are luggish and slow until he opens them one by one so that they are unswapped.

Is there a way the program can force other programs out of swap file when it stops simulation so that they again run smoothly?

+2  A: 

Loop through system and user processes, starting with one that uses most memory (aside from your background application) or one that is used most by the employee, and send the process a WM_ACTIVATEAPP message. That should have the same effect as "clicking" an application window icon of said process in the taskbar.

amn