### Queuing Incoming Calls

Each server process uses a first-in, first-out call queue. When the server is already executing its maximum number of concurrent calls, it uses the queue to hold incoming calls. The capacity of queues for incoming calls is implementation dependent; most implementations offer a small queue capacity, which may be a multiple of the maximum number of concurrently executing calls.

A call is rejected if the call queue is full. The appearance of the rejected call depends on the RPC protocol the call is using, as follows:

· Connectionless (datagram) protocol

The server does not notify the client about this failure. The call fails as if the server does not exist, returning an rpc_s_comm_failure communications status code (rpc_x_comm_failure exception).

· Connection-oriented protocol

The server rejects the call with an rpc_s_server_too_busy communications status code (rpc_x_server_too_busy exception).

The server process routes each incoming call as it arrives. Call routing is illustrated by the server in the following figure. This server has the capacity to execute only one call concurrently. Its call queue has a capacity of eight calls. This figure consists of four stages (A through D) of call routing by a server process. On receiving any incoming call, the server begins by looking at the call queue.

Stages of Call Routing by a Server Process

The activities of the four stages in the preceding figure are described as follows:

1. In stage A, call 1 arrives at a server that lacks any other calls. When the call arrives, the queue is empty and a call thread is available. The server accepts the call and immediately passes it to a call thread. The requested remote procedure executes the call in that thread, which becomes temporarily unavailable.

2. In stage B, call 5 arrives. The call queue is partially full, so the server accepts the call and adds it to the end of the queue.

3. In stage C, call 11 arrives. The queue is full, so the server rejects this call, as it rejected the previous call, 10. (The caller can try again with the same or a different server.)

4. In stage D, the called procedure has completed call 1, making the call thread available. The server has removed call 2 from the queue and is passing it to the call thread for execution. Thus, the queue is partially empty as call 12 arrives, so the server accepts the call and adds it to the queue.

###