The Parallel Future Of The Browser

That are in short-term memory they can’t act on long-term memory directly and each core has to has its own short-term memory so let’s say.

That the first core pulls 8 from long-term memory into its short-term memory and then it adds 1 to get 9 and then puts the value back into long-term memory that means that the other cores can now access the result of this operation so the long-term memory holds 9 now.

And the second core is going to pull 9 into its short-term memory add 1 to get 10 and then put 10 back in long-term memory that means our end result is 10 so all is well but it wasn’t guaranteed to end up this way let’s see what happens when we change the order that.

The instructions happen on the different cores the first core pulls 8 from long-term memory and then the second core pulls a from long-term memory and you may already see where the problem is here then the first core adds 1 to.

Get 9 and then puts 9 back in long-term memory then the.

Second core as 1 to get 9 and puts 9 back in long-term memory so we end up with the results of 9 which is not what we wanted this kind of bug is.

Called a data race when you have parallel code with shared.

Memory so two different cores working with the same part of long-term memory.

At the same time you’re very likely to have these data races one way to get around this is to choose tasks that are pretty independent of each other so that they don’t need to share memory now let’s go back to the chrome and content.

Example that I was we were looking at before you might remember that I said all of these are fairly independent of each other that means that they’re perfect for this kind of parallelism where you don’t have to share memory between the cores and that’s called coarse grained parallelism that’s where you split up your program and some pretty large tasks that can be done independently of each other so that they.

Don’t have to share memory but they’re still going at the same time it’s actually pretty straightforward to do this you just need to figure out this you just need to figure out yeah woke you all up so so this coarse-grained parallel parallelism it’s pretty straightforward you just need to figure out those large independent tasks so chrome had this from the beginning the chrome engineers saw that they were going to need to.

Have some level of parallelism to be fast with these new architectures around the same time that chrome was seen this change in hardware and seeing that if they wanted to have a fast browser they were going to need to take advantage of this parallelism we were seeing the same thing we knew that we were going to have to have this coarse grained parallelism in our browser to if we.

Were going to keep up and we do note now although it took us a.

While to get there it was a multi-year effort we started testing our multi-process architecture and Firefox 48 with a small group of test users but it wasn’t until this past summer with Firefox 54 that we turned it on for all users it took us a while to get there because we weren’t starting.