How I can force Firefox to use all of CPU capacity?

1

Some programs like Firefox only use up to maximum 25% of all CPU (only 1 thread).

However some programs like WinRAR, use up to 100% of all CPU.

How can I force Firefox to use all capacity of CPU (like WinRAR)?

I have Windows 7 and Intel Core-i5 CPU (4 Thread).

EmRa228

Posted 2012-12-12T19:42:11.700

Reputation: 135

1Why would you want to...? Firefox doesn't need all those resources, for example, whereas winrar could. – nerdwaller – 2012-12-12T19:44:22.667

@nerdwaller some programs need high CPU but only use 25% of it. firefox is an example. – EmRa228 – 2012-12-12T19:46:01.837

Guess I didn't realize that Firefox was so resource hoggy, sorry - just asking :D – nerdwaller – 2012-12-12T19:46:47.780

I see these things in task manager, but what does using a percentage of a processor mean? – barlop – 2012-12-12T20:45:39.937

Answers

7

Some tasks can benefit from parallelism.
For instance if one person can build one house in 9 months, then (maybe) 9 people can build one house in one month.

But some tasks cannot benefit from parallelism.
For instance a woman can conceive & give birth to a baby in 9 months, then getting 9 women to produce one baby in one month will never happen.

Firefox is essentially an input-response program.
You type in a URL or click on a link.
Firefox issues a request to retrieve the web page from a remote server, and then waits.
When the web page is delivered, Firefox processes this input and renders it on the screen.
Firefox then waits for your next input action.

Firefox is a program that will not (significantly) benefit from parallelism.
So Firefox (apparently) is implemented as a single-threaded program to use only one core.
Whereas other programs, that are computational intensive and implemented as multi-threaded, such as WinRAR, do benefit from parallelism and are executed on several processors/cores.

sawdust

Posted 2012-12-12T19:42:11.700

Reputation: 14 697

1

IE and Chrome are able to process multiple tabs at once using the full CPU instead of messing around and tripping on threads. Often the entire Firefox freezes due to trivial things like one single tab rendering some snowflakes in JavaScript.

– Cees Timmerman – 2014-07-17T14:20:27.063

I think this answer is incorrect, despite the votes and being marked as best answer. The problem isn't retrieving a document. Rendering a web page can be very computational intensive and Firefox doesn't fully use both cores in my notebook. This makes the rendering of some pages veeeery laggy... – Diego – 2016-12-15T23:02:46.360

@Diego -- Try rereading the question and focus on the the last paragraph, especially the second sentence. Otherwise submit your own answer to the question. Note that the question is not why Firefox (or rendering web pages) is slow. Also note that this answer is four years old, and web pages have gotten more complex. "Firefox doesn't fully use both cores in my notebook." -- And the second sentence in the last paragraph explains why. – sawdust – 2016-12-16T00:35:41.787

5

You can't, only the developer of the program can.

The only option you have is if you want 100% CPU usage is open 4 copies of the program, each copy will take a core up.

Scott Chamberlain

Posted 2012-12-12T19:42:11.700

Reputation: 28 923

I install XAMPP and use mysql and httpd(apache service). my database have 5,000,000 record and run a query take long while to do, because them use only 25% of CPU. any solution? – EmRa228 – 2012-12-12T19:51:35.877

1

You did not ask about mysql, you asked about firefox. Please post your REAL question, you are falling in to the XY problem. There is DEFFINATLY stuff we can help you make mysql faster.

– Scott Chamberlain – 2012-12-12T19:52:57.903

i have this problem(25% use) with other programs, like firefox, dreamwevaer, notepad++ and etc. – EmRa228 – 2012-12-12T19:55:22.867

It is an API call, and there is software that can make that call (apparently affecting or on behalf of other software, or on behalf of the techie himself, whatever one's perspective is!) process hacker can make that API call, as apparently can "Process Lasso" from bitsum.com mentioned http://superuser.com/questions/136021/how-to-change-i-o-priority-of-a-process-or-thread-in-win7 That can change IO Priority, The thing is though, is that the right one, and are there more pertinent ones to change?

– barlop – 2012-12-14T07:10:33.610

@barlop that just changes priority, you still be stuck with one core at 100% and the other 3 at 0% (leaving you with 25% CPU usage) – Scott Chamberlain – 2012-12-14T07:16:02.870

yeah but what does a percentage of a cpu core mean? wouldn't it be calculated somehow, but based on how much time the thread or process uses on a processor core? and wouldn't priority affect that? – barlop – 2012-12-14T07:19:30.673

Yes, but if a application is single threaded it can only use one core at a time, hence my remark about 1 at 100 and the other 3 at 0. He is already at 100% on one core (25% total) usage so increasing priority will change nothing – Scott Chamberlain – 2012-12-14T07:21:19.673

@ScottChamberlain yeah but even for a single threaded process, it could use a % of one core not necessarily 100%, in fact i'd guess that perhaps it would typically use only a % of one core. (whichever way/however -and who knows how- % of a core is calculated). And priority might affect what % it uses – barlop – 2012-12-14T07:22:53.743

I see what you mean, looking at his question, he seemed to be talking about how many cores the program uses at 100%. nd when he says 25% he meant one core at 100% I suppose. I'd be amused/a bit surprised if winrar used 100% on 4 cores, i'd guess any program doing that would really screw with things and make the computer hard to use!! – barlop – 2012-12-14T07:28:09.733

Btw the % is calculated by how many cycles the CPU spent executing the program sence the last time you checked the windows performance counter. Also If the program set low priority on the threads you could use 100% of all cores but if anyone else needed to do something the program would yield processor time.

– Scott Chamberlain – 2012-12-14T07:28:59.100

3

Threads in Windows run until either their quanta (time slice) ends, they block (e.g., doing i/o that hasn't completed) or they're interrupted to run something higher priority that's just become ready.

Windows allows bumping the priority of a thread, all the way up to THREAD_PRIORITY_TIME_CRITICAL. But even the highest priority threads are occasionally interrupted to run lower-priority threads by the Windows scheduler, which uses random boosts to avoid a deadlock condition called priority inversion.

How or when an application creates new threads and what they do is a design decision embedded into the internal logic of the program, not something you can control except perhaps through the way you use the application, e.g., opening more tabs or whatever.

Bottom line is that if you're wondering what it takes to max out CPU usage as much as possible, the answer is takes a CPU-intensive activity with as many threads as you have processors, doesn't block on i/o and runs at higher priority (e.g., just being the foreground app) than other tasks.

Nicole Hamilton

Posted 2012-12-12T19:42:11.700

Reputation: 8 987

@barlop Increasing the priority of a process doesn't help it run faster, unless there is some other process also trying to use CPU. See my answer here: https://superuser.com/a/964389/348119

– Jamie Hanrahan – 2018-03-10T01:12:22.957

@JamieHanrahan of course (and the misconception in the mind of the question you answered is not one i've ever had nor is it one that this questioner has), but it's pretty common that there are other processes trying to use the cpu, there's almost never just one process. And the questioner asked "How can I force Firefox to use all capacity of CPU" surely the answer is to increase its priority. And of course, it also goes without saying that if the process is not running anything then the OS will be smart enough to not give it any CPU time! – barlop – 2018-03-10T03:02:25.257

@JamieHanrahan and I agree it affects who gets to run first..but I think it goes without saying that he's talking about a situation where there's some reason why a process should want all cpu time, i.e. there is some competing process.. But I think it's more than just who gets to run first. Processors multithread and while sometimes a processor might start with one particular process it could still switch to another one. On the other hand, sometimes a process could monopolise CPU time, so it didn't just start first, it also monopolised CPU time. – barlop – 2018-03-10T03:06:50.630

@JamieHanrahan So would putting the process's CPU priority to highest, make it run first and monopolise the time? (that seems to be what the questioner here wants) – barlop – 2018-03-10T03:07:58.243

No. It's already using 100% of one of the logical processors. The only way it can use more than that is to run stuff on other LPs at the same time - by creating additional threads. If it had additional threads then in the situation described it would already be using more than 25% of the total time. So, it only tries to run one thread, so it can't ever use more than it's using. Increasing the process's CPU priority doesn't change that. btw, CPU-bound processes' priority should usually be left at normal or even set lower, so they won't interfere with tasks where responsiveness is important. – Jamie Hanrahan – 2018-03-10T07:31:22.713

that is very informative. Would this be of use to him? http://superuser.com/questions/136021/how-to-change-i-o-priority-of-a-process-or-thread-in-win7 if so you could update your answer. Process hacker can change "IO priority" of a process or I suppose, the priority of all the process's threads or individual threads of it. Is that the priority he'd want to change? process hacker can make that API call, as apparently can "Process Lasso" from bitsum.com (a program which an answerer in that aforementioned su thread , works on). Is IO priority THE thing he'd want to change? or a thing ?

– barlop – 2012-12-12T20:59:24.420

With all your knowledge about thread priorities, can you really not answer whether that is the priority he should go for changing? and whether other thread priorities are more pertinent? – barlop – 2012-12-14T07:06:50.490

If a thread does i/o, there's a good chance it will block because i/o devices like disks are mechanical and very slow by comparison to the processor. For that reason, changing the i/o priority is unlikely to be anywhere near as effective as simply not doing i/o if your objective is to max out the processor. – Nicole Hamilton – 2012-12-14T07:59:23.410

1

No. Threading is a decision made by the application developer, and can only be used (or at least be beneficial) in certain cases. additionally, the CPU is only one component that may be taking execution time, and as such, if its waiting on disk or high frequency ram updates, then the CPU would still act exactly as you have described, despite the app being multithreaded and on a multicore chip.

Frank Thomas

Posted 2012-12-12T19:42:11.700

Reputation: 29 039

1

Mozilla Firefox is based on software that was written before CPUs with multiple cores got popular. As such it still uses a single process with complicated threading system that is not easy to split into separate programs. You could vote for and participate in the Electrolysis project:

The goal of the project is to run web content in a separate process from Firefox itself. The two major advantages of this model are security and performance. Security would improve because the content processes could be sandboxed (although sandboxing the content processes is a separate project from Electrolysis). Performance would improve because the browser UI would not be affected by poor performance of content code (be it layout or JavaScript). Also, content processes could be isolated from each other, which would have similar security and performance benefits.

Although the Gecko platform supports multiple processes, the Firefox frontend is not designed to use them. Work to make the frontend (including addons) support multiple processes was begun in early 2013. The project roadmap has more details.

Microsoft Internet Explorer and Google Chrome are already able to process multiple tabs at once using the full CPU instead of messing around and tripping on threads. Often the entire Firefox freezes due to trivial things like one single tab rendering some snowflakes in JavaScript.

Cees Timmerman

Posted 2012-12-12T19:42:11.700

Reputation: 1 240