Link to home
Start Free TrialLog in
Avatar of Nikhil Gupta
Nikhil Gupta

asked on

Create work load on window.

How can I burden the windows system so that system responds very slowly. Please tell some code in VC++ to create this situation?
Thanks in advance.
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

create an application with an infinite loop, the work load will depend on how many time you sleep. Something like this:

int Duty = 400;  // Workload for 400 miliseconds
int Idle = 600;   // Sleep 600 miliseconds
int t;

while (!endflag) {
    t = GetTickCount();    // miliseconds
    do {
        t = t; // dummy operation
    } while (GetTickCount()-t < Duty);
    Sleep(Idle);
}
Avatar of Nikhil Gupta
Nikhil Gupta

ASKER

I think calling Sleep will cause another processes to run but i want the system load to be heavy so that all processes in the system are affected.
ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial