Why do my web browsers cause my entire computer to hang?

23,940

Solution 1

Hangs are in general not solely caused by resource usage.

We're not talking about short freezes or slowness here, we are talking about an actual hang is there for more than a few seconds. Memory usage isn't usually the main cause of this because Windows 7 will crash programs that are using too much memory. Disk trashing isn't usually the main cause of this because such requests are asynchronous and certain necessary parts are kept in memory.

So, you would have to actually need an old computer that would let the slowness look like a hang. Or be an aggressive resource hog, but then you could have expected it in advance; hangs that happen with normal usage are usually none of the ones listed above...

Hangs are usually caused by drivers.

Imagine having 8 GB, an Octa Core processor and a SSD RAID. Are we prone to hangs now? No.

Drivers (and especially Network ones) are usually the main culprit that result in a hang because due to a bug in them they are waiting for a certain action that should execute immediately to timeout. Even for short hangs for which you don't see any resource usage, DPC Latency Checker and the more detailed LatencyMon do an excellent job at figuring out which Deferred Procedure Calls by your Drivers are slow.

The problem here is that people are unaware of how to troubleshoot this, I would say that you can analyze about any performance issue on Windows with this post explaining XPerf. But people usually stick with the Resource Monitor at best, which gives nowhere as much detail as tools like Process Explorer, Process Monitor and XPerf do...

Let me give you an example how a typical hang is resolved.

  • My brother complained that closing one of his internet tabs caused a 10 second freeze.

  • He was unable to move his mouse after closing the tab.

  • I used XPerf from the Windows SDK to analyze the performance of his system at a very low level.

    • Started the trace and made sure it traced as much information as it could.

    • Went to the browser, asked him to browse for some time and call me when the problem occurs.

    • Immediately stopped the trace.

  • Closing the Facebook tab caused this behavior. Closing a Google tab does not.

  • There was a spike visible on the network driver.

    • In more detailed analysis, this was due to too much connections being closed simultaneously.

      This makes sense, Facebook does a lot of asynchronous AJAX calls.

    • When a connection is closed, the driver is supposed to send a FIN or RST packet to the destination. It might have been that waiting for the acknowledgement for finalizing or resetting the connection was badly implemented...

  • Updated the network driver, problem resolved.

Solution 2

Firefox and Internet Explorer and other web browsers are actually probably some of the "biggest" programs on your computer, as far as resource usage goes.

While other programs may take up more space on your hard drive, modern web browsers will generally start with more than 100MB system memory (RAM) and go up very quickly from there. A Firefox session with 20 tabs open for days on end will often be using more than 1Gigabyte of system memory.

For comparison, Microsoft Excel, which takes hundreds of megabytes of space on your hard drive, uses only just around 15 megabytes of memory no matter how big the spreadsheet you have open.

Unless you're running a sophisticated audio/video program or a massive database, the web browsers will probably be the most resource-intensive programs you run.

Regarding crashing: your system usually hangs because it has encountered an error, not because it has run out of resources.

For instance, if you have a bad memory chip and Firefox or Internet Explorer, while opening, try to address that bad memory, the entire computer is likely to lock and fail.

However, Windows is pretty smart and should be able to tell you if a particular piece of hardware is causing the crashes.

I would recommend testing your computer memory using a tool such as Memtest x86 or similar if you experience frequent unexplained crashes.

Another possibility is a driver. Drivers are perhaps the most common cause of operating system crashes, and if a program tries using a resource that is controlled by a faulty driver, the entire computer will crash easily.

Updating your drivers is a good idea when tracking down possible problems. While you're at it, you should make sure your programs and operating system are fully patched as many patches contain stability updates that resolve common crash problems.

Solution 3

I think what you're talking about here is called thrashing, and while it can be caused by many programs trying to execute simultaneously, it's more commonly caused by having multiple programs attempt to access a hard drive at once.

When loading a program, it will usually attempt to load all other modules it needs. These files all come from your main storage, a hard drive. During this time, the computer will run and load much quicker if the program in question is given full access to the hard drive.

If not, and you attempt to do more than one thing at a time, the operating system will prioritize I/O requests based on the currently executing process (and then this gets into the process scheduler). Since no two things can access a hard drive at once, however, you find that the computer's throughput decreases drastically as it attempts to complete one process's I/O request, then the other, and back and fourth.

Not only does this cause increased wear-and-tear on the drive itself, the computer's performance is significantly affected. Almost all storage mediums reach their maximum speed doing one thing at at time (since you can only read/write to a single sector at once).


Now, a similar thing can happen when you run out of RAM, but for a different reason. When you run out of physical memory, the OS will try to write some of the RAM pages to a hard drive. All hard drives (SSD or mechanical) are much slower then RAM, so you always want to avoid paging stuff to a hard drive.

If the OS then keeps switching the process scheduler between two processes, each being paged in-sequence to the hard drive, the computer begins to thrash. This is because the OS executes one program for a small amount of time, then the other one (how long or how often depends on what scheduling method the OS uses). If the processes are too big to fit into RAM, they may be constantly purged/read back from the page/swapfile, causing a significant reduction in performance.

Share:
23,940

Related videos on Youtube

avirk
Author by

avirk

Updated on September 18, 2022

Comments

  • avirk
    avirk over 1 year

    I've observed this happen many times: A single program is not responding and all the other processes are running correctly and then the entire system hangs.

    I think this is because the process that is not responding is using all the available resources and none are left for the other processes.

    But shouldn't this only be for big programs which would take all the memory (RAM) available?

    Why then does this happen when I'm just launching Firefox or Internet Explorer, which seem to be smaller programs?

    Is there any way to keep the programs and the computer from hanging?

    • avirk
      avirk over 12 years
      @music2myear thanks to edit I really couldn't understand that how to ask this question. Thanks a lot.
    • avirk
      avirk over 12 years
      But I think my title was not wrong is it?
    • Ravindra Bawane
      Ravindra Bawane over 12 years
      No, it was not wrong. Since the question ended up mostly being about how your web browsers cause your computer to crash, rewording the title so that people have a better idea what your asking without opening the question can help get more people to look at your question.
    • Ravindra Bawane
      Ravindra Bawane over 12 years
      A more clear way of stating your title would be "What causes a computer to hang?" However, this is a VERY broad question and not many people would look at it. The details in your questio help narrow it down to some specific circumstances, but people have to open the question to see those details. Making your title clear helps get more people to look at the whole question.
    • avirk
      avirk over 12 years
      Ok then I will appreciate to back on changes made by you. Thanks.
  • Admin
    Admin almost 12 years
    +1 for pointing out that browsers are NOT small apps, at least by home user standards. I would point out, though, that Excel can have a comparable memory footprint (up to about 0.5 GB in my experience) when working with larger files.
  • Ravindra Bawane
    Ravindra Bawane over 11 years
    I'll take your word for that Jon, but in my extensive experience as a technologist in support roles, I've only seen excel.exe itself, even with huge files, taking 15MB of memory. I'm not sure where the rest of the file is stored, if the program only caches that much of any given spreadsheet, or some other M$ black magic is going on.
  • Admin
    Admin over 11 years
    I'm sure the size of the file matters. At this moment, Excel is using 15 MB of PWS mem on my home computer, with a lil' 250-KB file open. However, I also work with must larger files regularly, up to about 50 MB, and the memory footprint can be much higher. On the whole, I'm impressed with how little it uses, especially compared to browsers.
  • Ravindra Bawane
    Ravindra Bawane over 11 years
    Hmm. I wonder if 64-bit/32-bit makes a difference. I work with a 400-500kb .xls file regularly and Excel only uses around 6MB on my win7 64-bit system. I expanded the file by creating copies of existing worksheets and converted to an .xlsx, size went up to just shy of 600kb, and then Excel was using 15MB, and stayed there as I added colors and filters and such. It would be interesting to do a study on what sorts of data and types cause what sort of Excel memory usage.