Concurrent Servers Vs. Multithreaded Servers

Servers are those which accept incoming connections from all users. These server systems serve connected users by providing data and many other services via a connected network connection. Servers generally represents shared resources and they also have the ability to maintain multiple connections at any given amount of time. For accomplishing this, servers handle requests concurrently. For this they use threading or multiple processor. But there are some differences in these approaches, but both these techniques accomplish similar tasks of the same user. Lets have a look what’s the difference in both of them.

Threading and Concurrency

Concurrency refers to the ability of a computer system to run multiple instances of code at a time. Basically the programmer implements concurrency in exactly two ways. The first implementation method is through concurrent processes. In this the programmer generally writes code which generated an entire new programming process and occupies its own process ID and space in memory. The second option if via threads. The thread is run inside the process creation. In this the sharing of resources in done for creating the program, but without the overhead of memory usage.

Concurrent Servers

The main job of concurrent server software is to serve data concurrently instead of handling them serially. It simply means that at a time multiple users can use servers and the server programs, handles requests from various users at the same time. For accomplishing this, the server package creates new instances of the server program for every connection. The process named “daemon” generally listen the incoming connections and then create a new server process for every new connection.

Multithreaded Servers

The goal of multithread servers is same as that of concurrent servers, but it also allows concurrent rather than serial connections for server resources. So here instead of creating a new server process for every new connection to the multithread server creates small threads for execution inside the server program. The working of this thread begins when the user makes a new socket connection, and whenever the connection is lost then it return to the main process.

Concurrent Vs. Multithreaded servers

As it is mentioned that both the server do similar tasks, but there is a slight difference in their way of doing it. A concurrent server uses a separate server process for handling every connection and it will never work perfectly as a multithread server. The server must spawn instances of the new server for every connection. Lightweight threads are used by multithread servers because they are very efficient for connection. Users who want to connect with the server for long time period or those who are engaged in heavy data usage must use their own instances as compared to a thread.



0 comments:

Post a Comment