Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between distributed, high concurrency and multithreading

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Multithreading refers to the technology of concurrent execution of multiple threads from software or hardware, it is more to solve the problem of CPU scheduling multiple processes, so that these processes appear to be executed at the same time (actually running alternately).

When it comes to these three words, do many people think that distributed = high concurrency = multithreading?

Does the interviewer look confused when he asks what measures can be used to solve the problem of high concurrency systems, or how distributed systems can solve the problem of consistency?

Indeed, at the beginning of contact, many people will confuse the three, mistakenly thinking that the so-called distributed high concurrency system can be accessed by a large number of users at the same time, and the use of multithreading means can provide the concurrency ability of the system. In fact, the three of them are always accompanied by each other, but the emphasis is different.

What is distributed?

A more distributed concept is an optimization approach to solve the capacity and performance bottlenecks of a single physical server. There are many problems to be solved in this field, including distributed file system, distributed cache, distributed database, distributed computing and so on. Some nouns such as Hadoop, zookeeper, MQ and so on are related to distribution. Conceptually, there are two forms of distributed implementation:

Horizontal scaling: when a machine cannot handle traffic, it distributes the traffic equally to all servers by adding machines, and all machines can provide equivalent services.

Vertical split: when there are multiple query requirements at the front end, one machine can not handle it, and different requirements can be distributed to different machines, such as A machine processes the remaining ticket query request, and B machine handles the payment request.

What is high concurrency?

Compared with distributed, high concurrency is more concentrated in solving problems, which reflects how many problems there are at the same time: such as online live streaming service, which is watched by tens of thousands of people at the same time.

High concurrency can be solved by distributed technology, so that concurrent traffic can not be divided into different physical servers. But in addition, there are many other optimization tools: for example, using a caching system to put all static content into CDN, etc.; you can also use multi-threading technology to maximize the service capacity of a server.

What is multithreading?

Multithreading refers to the technology of concurrent execution of multiple threads from software or hardware, it is more to solve the problem of CPU scheduling multiple processes, so that these processes appear to be executed at the same time (actually running alternately).

Among these concepts, the problem solved by multithreading is the most clear, and the means are relatively single. Basically, the biggest problem encountered is thread safety. In JVM language, it is necessary to have an in-depth understanding of Java memory model and instruction rearrangement in order to write a high-quality multithreaded code.

To sum up:

Distributed is to compose different machines into a whole external service from the point of view of physical resources. the scope of technology is very controlled and very difficult. With this basis, systems with high concurrency and high throughput are easy to build.

High concurrency is the ability to describe the system from a business point of view. The means to achieve high concurrency can be distributed, such as caching, CDN and, of course, multithreading.

Multithreading focuses on how to use programming languages to maximize CPU scheduling capabilities.

Distributed and highly concurrent systems involve a large number of concepts and knowledge points. If there is no systematic learning, it is easy to mix concepts and not identify clearly, and difficulties will be encountered in interviews and practical work.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report