开发者

Which is better choice for browser's tab: multi-thread or multi-process? [closed]

开发者 https://www.devze.com 2023-01-26 09:28 出处:网络
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing
Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 9 years ago.

I开发者_开发问答mprove this question

I wonder which is a better choice for implementing tabs in a web browser? (Ex: Firefox use multi-threading for their tabs, while Google Chrome use multi-processes ... )


It depends on the quality of your implementation and your priorities. Threads have the potential to use less memory/share more, and might perform better or worse than processes depending on synchronization primitives you use. On the other hand, with the utter crap quality of browser implementations, do you really want the whole browser and all your tabs crashing when one bad site tricks the browser into allocating unbounded amounts of memory or worse?

Multi-process browser implementations are a lot like the privilege separation model in OpenSSH, vsftpd, etc. You're sacrificing some resources to have the kernel protect you against bugs in your code.


It depends on what your needs are.

If you are

  • Looking for a resource minimal browser
  • Not running heavy javascripts
  • Not having a lot of memory

Then you are probably going to go with multi threading.

However, if you are

  • Running many pages at once
  • Running resource intensive web applications

You probably are going to want multi-process. Since most computers and web applications fit in the second category today, Multi-Process is probably, today the better choice. This is because processes allow you to separate each tab in its own sandbox. That means if one tab crashes, you aren't going to lose the other tabs.


Answer: It's a tradeoff.

Threads: on Windows are usually best no matter what. Processes are resource hungry implementations on those systems.

Processes: are good if security / stability is a chief concern. Because one process going down is much less likely to bring the whole browser down. (But why should the browser be expected to crash?) And is easier to securely isolate using OS primitives, but at a cost of more system resources (how much depends on the OS).

Hybrid: AKA Using Processes and Threads. This is the best approach. Loading a certain number of components, using threads until the process becomes large enough to justify the additional overhead of another process (depending on the OS), and then creating another process.


What do you mean, 'which is a better choice'? You have to define "better" before you can discuss why one is better than the other. What are you goals, and what are their relative priorities? Which is most important, stability, memory usage, CPU time, number of kernel objects in use? The answer you want will require you to provide these priorities first. That is, you need to define what "better" is before we can help you decide which one is better.


Well i think every time we open a new tab , it creates a thread , and it is benificial as thread will not require another resoces and will not use more memory and your system spped will not get more affected.


I think a multi-process is a better approach. In multi-thread there are security issues, and we don't want some one to steal our credit card number. If one process becomes slow, due that whole browser would crash down,does not make sense. Where as if our browser is very specific to certain application like research only, which deals with only a subset of internet we can analyse the pros and cons of process and thread based browser. A multi-thread browser would sure be fast and easily synchronized.

0

精彩评论

暂无评论...
验证码 换一张
取 消