The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
10 views
Servers can be designed to limit the number of open connections. For example, a server may wish to have only N socket connections at any point in time. As soon as N connections are made, the server will not accept another incoming connection until an existing connection is released. Explain how semaphores can be used by a server to limit the number of concurrent connections.
in Operating System by Boss (41.3k points) | 10 views
0

Server process may look like

S = n; // maximum number of request that can be handled by server
mutex = 1;   
Server() {
    while(true) {
        wait(S);
        wait(mutex);
        
            Critical Section
        
        signal(mutex);
        signal(S);
    }
}

Once more than n number of request arrive, server will suspend their request, but as soon as existing connection is released server will be able to accept new connections.

Please log in or register to answer this question.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,833 questions
54,800 answers
189,506 comments
80,724 users