Firefox To Get Multi-Process Browsing 383
Posted
by
Soulskill
from the multi-fox dept.
from the multi-fox dept.
An anonymous reader writes with news that multi-process browsing will be coming to Firefox. The project is called Electrolysis, and the developers "have already assembled a prototype that renders a page in a separate process from the interface shell in which it is displayed." Mozilla's Benjamin Smedberg says they're currently "[sprinting] as fast as possible to get basic code working, running simple testcase plugins and content tabs in a separate process," after which they'll fix everything that breaks in the process. Further details of their plan are available on the Mozilla wiki, and a summary is up at TechFragments.
Re:So sad... (Score:5, Informative)
Actually, they're talking about multiple processes, not multithreading. Threads all belong to a single process, which, if it crashes, will bring down all of its threads. Running the shell in one process, then each tab/window in its own process means that, much like Chrome, a single page can't bring down the myriad of tabs/windows you might have open, if you browse the web like I do.
Re:About time (Score:5, Informative)
According to the Ars coverage [arstechnica.com]:
It was probably too large a project to consider doing without a pressing need. Chrome and IE8 supplied that pressure.
Re:About time (Score:5, Informative)
So your single-core cpu is only ever capable of running a single process? The advantages of a multi-process browser go way beyond running the processes on separate cores.
Re:Why a process? Surely a thread would scale bett (Score:3, Informative)
Forking a process on unix-like systems if fairly lightweight but for Windows this will not scale well at all.
The Microsoft folks don't seem concerned about this, at least not concerned enough to implement it in IE. While I don't doubt that Windows processes are fairly heavyweight, I doubt that they're big enough to cause trouble until the user has hundreds of tabs open.
Why not just have rendering worker threads? Have I missed something?
Although working in multiple threads can increase performance in much the same way that multiple processes can, that's not the major benefit of the multi-process architecture. The big benefit to multiple processes is that if one of them dies for some reason, the other processes don't go down, and so the user can (mostly) continue to work. Threads can't do this, because all the threads are still part of a single process.
Re:About time (Score:3, Informative)
>Most of the people are still running a single core CPU.
Do not confuse multi-process with multi-processor (or multi-core).
Even a single core machine can make use of multiple tasks, or threads, or processes, to get more work done while waiting for one task to complete.
When monolithic code reaches a point where it is waiting for data from the server, it stalls. Multiprocess code has another process it can put to use rendering the images, or playing the goddamed flash.
Re:About time (Score:5, Informative)
This isn't really about CPU/Core counts, having tabs/plug-ins running in a separate process is useful because if that page/plug-in crashes that process, the remaining pages won't be effected. I highly doubt they will be dabbling with being able to set which processor a certain process runs on (just yet).
This won't really make use of extra processors/cores, that's what threads (should) already do, even if the application doesn't have any special code to do so.
Re:About time (Score:3, Informative)
if they bothered to anticipate our fifty bajillion core processors back then like any NORMAL person should today, they wouldn't be in this mess!
Processes don't offer more multicore support than threads. What they do offer is clean separation of code that can run independently.
Re:Nice (Score:4, Informative)
Re:Humiliated By Google's Chrome (Score:5, Informative)
Threading for Javascript? Not possible! Stop asking for something that can't be done! The Firefox devs cried!
Opposition to threading by Firefox devs came from, among others, Brendan Eich, the inventor of Javascript. You can read his well supported arguments on Bugzilla [mozilla.org].
That doesn't excuse Firefox devs from not supporting a parallel architecture earlier, from which users would significantly benefit. But the conversation on that link is an oculus into the reasoning behind not having a parallel architecture earlier.
Does that mean distributed XPCOM? (Score:5, Informative)
One way to implementing multi-process Firefox is first allow XPCOM to work across process. i.e. allow objects to be via XPCOM that are actually spawned in another process, one explicitly created for the task. In COM it had a thing called a running object table (ROT). When you create a process hosted object it looks to see if one is running already, and if not it uses the registry info to spawn one. Then it waits for it to start and then it tells the process to create the object, sets up all the marshaling etc. XPCOM could do something similar, though it would have to do so in a cross-platform manner. I assume that Firefox would have to determine when creating a browser object first if it was chrome or content, and if it was content to spawn a host process and then set up the interfaces. Once set up and assuming the interfaces were efficient, the effect would be largely transparent.
The biggest performance hit would probably be on anything which tried to call or iterate over the DOM boundary between chrome and content. For example chrome which introspected content would suffer because all the calls would have to be serialized / deserialized.
Personally I think its feasible but it would hit performance. An alternative would be to just host plugins in another process. Windowless plugins might be a pain to implement but at least you could kill the other process if a plugin goes nuts which seems to happen all too frequently for me.
Re:About time (Score:3, Informative)
Funny thing is, they're already in the middle of a major revision project. After Fx2, Brendan Eich released a set of goals for Mozilla 2 [mozillazine.org]. The idea is/was to do a large scale cleanup and refactoring (explicitly not a rewrite, however) in order to get rid of some legacy code still around from overly ambitious plans that didn't pan out (e.g. XPCOM). That was to happen in parallel to the development of Fx3 on Gecko 1.9.0.
It's not clear how much progress has been made on Gecko 2.0—almost no public-facing announcements are made about it to the community, and the wiki page [mozilla.org] is dormant. All the work and focus seems to have been poured into Gecko 1.9.1 (Fx3.5) and now 1.9.2 (Firefox.next).
One element of Eich's vision for Mozilla 2 was implemented in 3.5 – the new faster javascript implementation. But the smaller, leaner, more approachable codebase goal? Who knows.
Now it seems they're attempting 'Electrolysis [mozilla.org]' (the codename for process separation) in parallel to the development of Firefox.next (Gecko 1.9.2), which is already ostensibly being done in parallel to the Mozilla 2 refactoring. Makes you wonder if there's anyone at the wheel.
Here's an essay I wrote about Mozilla's direction [kuro5hin.org] back in 2007 when Mozilla 2 was supposed to kick off.
Re:Will this benefit the average user? (Score:4, Informative)
Re:About time (Score:3, Informative)
No commercial program on earth takes advantage of more than two cores...
What? Yes, even some of the "high-end drafting" programs do, every single 3D Modeling and/or Drafting application I have, can use 1, 2, or 4 (and likely upwards, but the highest core/CPU PC I have is 4) as they see fit.
Operating Systems are a "commercial program", and most of them can handle 8, 16, 32 or more processors.
If you have information as to otherwise, I'd be highly interested.
Re:About time (Score:3, Informative)
It's not a question of multi-core architecture. No commercial program on earth takes advantage of more than two cores, not even the high-end drafting programs on mirrored quad Xeons.
That is a ridiculously untrue statement. Oracle's database certainly uses more than two cores (yes, even the Windows version). A number of engineering and 3D/rendering packages I'm aware of can use more than two cores.
Re:Nice (Score:5, Informative)
Re:Does that mean distributed XPCOM? (Score:4, Informative)
Re:About time (Score:4, Informative)
Ask your admins to change the proxy PAC to not using the isInNet function, as this
requires the DNS to check if every domain/hostname exists before deciding what proxy
to use... isnt easy to solve...
i work around with this:
if ( shExpMatch(url, "*127.0.0*") ||
shExpMatch(url, "*192.168.*") ||
shExpMatch(url, "*10.15.*") ||
shExpMatch(url, "*10.16.*") ||
shExpMatch(url, "*10.17.*")
){ if ( isInNet(host, "127.0.0.0", "255.0.0.0") ||
isInNet(host, "192.168.0.0", "255.255.0.0") ||
isInNet(host, "10.15.0.0", "255.255.0.0") ||
isInNet(host, "10.16.0.0", "255.255.0.0") ||
isInNet(host, "10.17.0.0", "255.255.0.0")
) { return "DIRECT"; }
else { return "PROXY 192.168.1.10:3128"; }
}
this way it just use the "bad" function if there is a IP in the URL...
all rest, its defined using domains/hostnames, no need for the isInNet
good luck
First Virtualbox SMP support, now this (Score:2, Informative)
Finally, apps are getting more multi-CPU focused. Very cool. All of us with multi processor systems thank you.
Re:Will this benefit the average user? (Score:3, Informative)
For users with anything pre-multi-core (and that's only a few years old), this will result in things getting *slower* because of the process overhead.
You are vastly over-estimating the impact of a process switch on any hardware from the last decade or more. Right now, my WinXP PC is running 53 processes. If I click another application on my task bar, a full screen has redrawn with the new application's window before my finger has finished releasing the mouse button I clicked. Do you have any idea how many process switches took place in the fraction of a second while that happened?
Better philosophical architecture is a good thing.
There's a lot more than philosophy going on here.
Independent processes allow a dramatic improvement in robustness. Any plug-in, heck even a hostile JavaScript, can take out your entire Firefox browser right now. Plenty of people browse with many windows open doing everything from writing e-mail to posting on social networking sites to watching YouTube. All of that goes boom if a single tab hits a single plug-in/scripting bug.
Independent processes also allow improvements in security. Resources on modern operating systems are typically allocated on a per-process basis; this is the difference between a process and a thread. Avoiding sharing resources between different tabs, where such tabs might contain scripts or plug-ins that you have granted certain extra permissions, is a good thing.
And of course, in practice, many people are now running on multi-core hardware that will benefit in performance terms as well. Moreover, major architectural clean-ups on software projects tend to improve performance as a side-effect anyway.
I'm afraid your post is one long stream of technically incompetent FUD.
Re:About time (Score:5, Informative)
Re:Diamond Joe Quimby: "It Can Be Two Things" (Score:3, Informative)
http://www.microsoft.com/windows/internet-explorer/get-the-facts/browser-comparison.aspx [microsoft.com]
That link is the only thing I've seen, IE8-wise, comparing it to other browsers. But generally IE doesn't get advertised at all-- I haven't seen an IE ad in ages. (Of course, I don't watch TV, so there's a whole world of advertising I get no exposure to.)
Re:About time (Score:3, Informative)
> But the smaller, leaner, more approachable codebase goal?
Somewhat. It doesn't get blogged about much, and when it's blogged about the press doesn't pick it up because nitty-gritty arch work is boring. But there have in fact been significant simplifications to all sorts of stuff in the meantime...
The really ambitious "break compat and all" plan for Mozilla2 seems to have been somewhat abandoned for now, though.
Uh... almost always? (Score:1, Informative)
At least if you're using the WebSphere AppServer it does.
Background: OutOfMemory is the single most useless exception of [b]any[/b] VM. Once it's out of memory there is almost nothing you can do, short of aborting the process to let the system reclaim the memory. Much better to design your processes to fail gracefully (i.e. atomically/transactionally). That's why Erlang is so popular amongst people who want 99.999% uptime.
Re:About time (Score:1, Informative)
Actually, there's no such thing as an OutOfMemoryException in Java.
Re:About time (Score:4, Informative)
A non-blocking call implies multi-threaded design, genius.
It really doesn't. Maybe a similar design to a multithreaded app, but more accurately an event model, not a thread model. It's cooperative multitasking, which means it won't hit multiple processors, and generally won't have anywhere near the same kind of concurrency issues.
I suppose you could make the argument that the OS is doing the threading for you, or that it's a kind of green threads, but at that point, it's both a semantic argument, and it's losing any semblance of meaning of "threaded".
continuous improvement (Score:3, Informative)
The idea is/was to do a large scale cleanup and refactoring.
And it's getting done in pieces. Mozilla developers wrote a string of tools (Elsa, Oink, TreeHydra, DeHydra) to analyze the codebase, all open source and some contributing to GCC's rearchitecture to better support plug-ins Developers can then pick specific cleanups and refactoring and identify exactly what code is affected and even do rewrites, though these go through code review. This happens steadily.
DeCOMtamination [mozilla.org] proceeds [mozilla.com]. In each release a few major internal rewrites get in, like the switch to thebes on Cairo and the HTML reflow changes; upcoming is Combined nsImage* & gfxImageFrame [mozilla.org] and the HTML5 parser.
There's no need to wonder when all the development takes place in the open. Pay attention or don't style yourself as an armchair expert.
Re:About time (Score:2, Informative)
> I can confidently say "loved" was never one of them.
Whippersnapper. You say "never" because you're too young to remember.
When Navigator 4.0 was first out, and people were comparing it to version 3, the new version was a huge improvement. It wasn't until it'd been out for several years and the most significant update was the Communicator suite (which used more memory and didn't improve the browsing experience at all) that the cheers started to turn into groans, and then when version 5 didn't come out, and didn't come out, and didn't come out, the groans eventually turned to outright boos and hisses. But that was years later.
Heck, I remember when people loved Netscape 2. Of course, back then the other main option was NCSA Mosaic. Or gopher.
Do I want to use any of that stuff *now*? Not on your life. But I loved Navigator 4.08 well enough in its day.