DEV Community


Multi Thread Model

Ditikrushna Giri
・1 min read

In multi thread model the server assigned incoming request to the new thread . Similar as a client server architecture the user generate a request while interacting with the application and then send to the server .

The every times a new request comes in the server map a new thread from thread pool to the incoming request then the thread is responsible for process that request and sending back the response .

The number of thread is equal to the number of thread used from the thread pools .

Now , the thread present in the thread pools are limited to the based on the resource available .

If we look closely we will find the limitation of multi thread model . Suppose we have millions of request coming in per second are the thread present in the thread pools are limited number there will be situation where all the thread are exhausted from the thread pools in that situation a incoming request has to wait until a thread process the last request and return back the result .

This is a situation of scalability which could be resolve by adding more resource and creating more thread inside the thread pools .

Limitation of Multi Thread Model :

  • In multi-thread model , for every request server creates a separate thread which handles that request .
  • If a thread acquired a lock in the shared resource and it is 'exclusive lock ' it will block other threads .

Discussion (0)