What about creating a new thread with the highest priority? Calculating Pi will never end and with a high priority it should lag your system down. If you have several processors you could start several threads to calculate pi or have a separate program that calculates pi and start several processes of it?
Public Class Test
Shared Sub Main()
Dim threadLag As Thread = _
New Thread(AddressOf CalculatePi)
threadLag.Name = "ThreadWait"
threadLag.Priority = ThreadPriority.Highest
threadLag.Start()
End Sub
Private Sub LagRoutine()
While True
Thread.SpinWait(10000)
End While
End Sub
End Class
or
Public Class Test
Shared Sub Main()
For i as Integer = 1 to 10
Dim p As New Process("C:\MyLagProgram.exe")
p.Start()
Next i
End Sub
End Class
CalculatePi
MSDN
Update:
I think Eric might have a good point about SpinWait and it might be more what you are looking for:
The SpinWait method is useful for
implementing locks. Classes in the
.NET Framework, such as Monitor and
ReaderWriterLock, use this method
internally. SpinWait essentially puts
the processor into a very tight loop,
with the loop count specified by the
iterations parameter. The duration of
the wait therefore depends on the
speed of the processor.
Contrast this with the Sleep method. A
thread that calls Sleep yields the
rest of its current slice of processor
time, even if the specified interval
is zero. Specifying a non-zero
interval for Sleep removes the thread
from consideration by the thread
scheduler until the time interval has
elapsed.
There is no System IO, its basically just a tight loop which does not give up its processing time. I am sure if you used my suggestion of spawning several threads with the highest priority with Eric's suggestion SpinWait you would achieve what you are looking for. This would also reduce the amount of code you would need to write.