Question: Is an HTTP request a thread? Does java service open a new thread to process each request?

 

Reprinted article address: https://blog.csdn.net/weixin_39833509/article/details/88603957 [Learn to use collection reprint, if you have any questions, please contact me to delete]

---------------------------------------------------------

Reprinted weixin_39833509  last published on 2019-03-16 19:30:29 Reading number 5459   collection

Unfold

Is an http request a thread? Is java service a new thread for processing every time a request is received?

The answer is: yes, an http request is just a thread.

Insert picture description here

https://blog.csdn.net/elvis_lfc/article/details/53466877

Insert picture description here

https://blog.csdn.net/h12kjgj/article/details/55063956

Insert picture description here

=== Summary

1http请求,就是来银行办理业务的用户。
  • 1

2tomcat is the bank

3 A thread is to open a window

5 threads are shared CPU, so multi-threading can improve processing speed than single thread?

For example, a window (a CPU), three people to handle business.

Single thread: one after another.

Multi-threading: Everyone will do it in turn, I will do it for you later, you will do it for him later.

But single-threaded, multi-threaded, the same time-consuming. Does not improve efficiency, so why do you say that multithreading is more efficient than single threading?

Insert picture description here

 

Published 81 original articles · Like1 · Visits 30,000+

Guess you like

Origin blog.csdn.net/xiaoanzi123/article/details/105537298