Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1057165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:49:28+00:00 2026-05-16T17:49:28+00:00

I need to induce a variable amount of lag in vb.net. System should be

  • 0

I need to induce a variable amount of lag in vb.net. System should be noticeably slower.

I can raise the CPU usage of the program with infinite loops and some variable creation/assignments, but how can I actually cause lag?

I understand this is an odd request, but I appreciate any help and would appreciate it being taken seriously. This is NOT being used maliciously.

I’d like to have an “InvokeLag” sub which will perform an action to slow down the computer, the faster the function is called the faster it lags. The function should be as mundane as possible, not modifying anything or doing anything to cause damage other than simple lag.

Thanks for your help!

EDIT: Preferably only achieving this effect with crazy math operations and making variables and such. Nothing system if possible.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:49:29+00:00Added an answer on May 16, 2026 at 5:49 pm

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

need ask you about some help. I have web app running in Net 2.0.
I need to know about Epoll On linux System. Could you recommend manual or
Need a function that takes a character as a parameter and returns true if
Need a way to allow sorting except for last item with in a list.
Need to an expression that returns only things with an I followed by either
Need to locate the following pattern: The letter I followed by a space then
Need a function like: function isGoogleURL(url) { ... } that returns true iff URL
I need to copy hundreds of gigs of random files around on my computer
I need to send hundreds of newsletters, but would like to check first if
I need to launch a server on the remote machine and retrieve the port

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.