128 putting it together the tiny web server 653

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: alternative concurrent server designs based on processes and threads. 12.6.1 Concurrent Servers Based on Processes A concurrent server based on processes accepts connection requests in the parent and forks a separate child process to service each client. For example, suppose we have two clients and a server that is listening for connection requests on a listening descriptor 3. Now suppose that the server accepts a connection request from client 1 and returns connected descriptor 4, as shown in Figure 12.30. client 1 clientfd connection request listenfd(3) server connfd(4) client 2 clientfd Figure 12.30: Server accepts connection request from client. After accepting the connection request, the server forks a child, which gets a complete copy of the server’s 12.6. CONCURRENT SERVERS 639 descriptor table. The child closes its copy of listening descriptor 3 and the parent closes its copy of connected descriptor 4, since they will not be needed. This gives us the situation in Figure 12.31, where...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online