🎓 BookMCQ
← Back to 3. Processes in Operating System

📝 Client server communication in the context of processes in operating system (35 MCQs)

Client and Server Processes in Operating System Communication

Client-server communication is an IPC model in which one process requests a service and another process provides it. The client sends a request containing the required operation and data, while the server processes the request and returns a response. This model supports local services and networked applications, allowing programs to cooperate without sharing their complete internal execution state or memory.

Why Service Requests Are Separated Between Processes

Dividing applications into clients and servers improves modularity and allows services to operate independently of requesting programs. A server can manage shared resources, handle multiple clients, and centralise specific operations. However, independent processes require communication channels and suitable request-handling policies. Network-based communication also introduces latency, connection failures, authentication requirements, and the possibility of unavailable servers.

Request Handling Through Sockets and Remote Procedure Calls

A client establishes communication through an appropriate endpoint, commonly using sockets for network communication. It sends a request that the server receives, interprets, and processes. The server returns a response through the established communication mechanism. Remote procedure call (RPC) systems provide higher-level abstractions by presenting remote operations through procedure-like interfaces, while hiding some communication details.

Two Processes Exchanging a Database Query Over TCP

Suppose a client process connects to a database server using TCP and sends a query requesting 25 customer records. The server receives the request, validates it, executes the query, and returns the results through the connection. The client reads the response and processes the returned records. TCP provides an ordered byte stream, not automatic application-level message boundaries.

Concurrent Clients, Response Latency, and Server Reliability

Client-server architecture allows a shared service to support many independent applications and users. Servers may use multiple processes or threads to handle concurrent requests, improving throughput when resources permit. However, excessive client demand can exhaust connections, CPU time, or memory. Network delay, server failure, authentication weaknesses, and poorly managed request queues can also degrade service availability.

Misconceptions About Client-Server Process Communication

'A client and server must execute on separate computers' is incorrect because both can communicate through local IPC. 'TCP preserves application message boundaries' is incorrect because it provides a continuous byte stream. 'A server can process unlimited simultaneous clients' is incorrect because available CPU, memory, connections, and scheduling capacity impose limits.

Exam Focus: Tracing Client Requests and Server Responses

Trace the communication sequence from client connection and request transmission through server processing and response delivery. Distinguish sockets, TCP connections, RPC, and ordinary local procedure calls. Questions may examine concurrent client handling, blocking communication, server process creation, network reliability, and the difference between transport-level byte streams and application-level messages.

Key Terms of Client-Server Communication

  • Client - Process requesting a service.
  • Server - Process providing a service.
  • Socket - Communication endpoint between processes.
  • TCP - Reliable ordered byte-stream transport protocol.
  • RPC - Remote procedure call mechanism.
  • Request - Message asking for a service.
6
Easy
16
Medium
13
Hard

📝 All Client server communication in the context of processes in operating system MCQs

Q1. Which role in the client-server model initiates requests for a service?

A.Server
B.Client ✅
C.Router
D.Bootloader
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: In the client-server model the client starts communication by sending a request, while the server waits to receive requests and returns results. The clear division of initiating and responding roles is what allows one server to serve many clients over the network or within a single machine.

Q2. Which system call marks a socket as passive so that it can accept incoming connection requests?

A.connect
B.listen ✅
C.bind
D.send
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The listen call turns a bound socket into a passive socket that queues incoming connection requests. The server then calls accept to take a request from that queue. Connect is the client's call to start a connection, so it does not serve the same role.

Q3. What is a remote procedure call?

A.A way to invoke a procedure on another machine as if it were a local call. ✅
B.A type of disk partition.
C.A program that deletes remote files.
D.A keyboard shortcut for printing.
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: A remote procedure call lets a program call a function that executes on a remote system, while the programmer writes what appears to be an ordinary call. Stubs and the network transport handle the details, so the abstraction hides communication from the calling code while still requiring careful handling of failures.

Q4. Which component converts procedure parameters into a form suitable for transmission across a network in a remote procedure call?

A.The marshalling code in the client and server stubs ✅
B.The kernel's scheduler
C.The printer driver
D.The file system
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Marshalling packs arguments into a message format that can be sent over the network, and unmarshalling reverses the process at the other end. Stubs generated on each side perform this work so that application code can remain unaware of the transmission details.

Q5. Which server design creates a new child process to handle each incoming client request?

A.Iterative server
B.Concurrent forking server ✅
C.Batch server
D.Stateless proxy with no processes
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: A concurrent forking server accepts a connection and forks a child that serves the client while the parent returns to accepting new connections. This lets many clients be served at the same time, which an iterative server cannot do since it handles one client at a time.

Q6. A student believes that a client and server must always run on different machines. Which correction is most accurate?

A.The student is correct because a single machine can never host both.
B.Client and server are roles, and they can be separate processes on the same machine communicating through sockets or other mechanisms. ✅
C.Clients and servers cannot use sockets at all.
D.Servers are always printers.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The client-server model describes roles and interaction, not physical location. A client and server running on one machine communicate through the same socket interface used across a network. Recognising this helps designers test networked services locally and understand that communication mechanisms, not distances, define the model.

Q7. Why must a server call bind before it calls listen?

A.Bind assigns the address and port that clients will use to reach the server, and listen cannot make the socket reachable without it. ✅
B.Bind deletes the server's previous connections.
C.Bind starts the client's program.
D.Bind is only used for printers.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A socket has no address until it is bound, so clients have nothing to connect to. Listen then prepares the bound socket to accept connections. Reversing the order would leave the socket without a reachable address, which is why the sequence bind, listen, accept is standard.

Q8. Why does an iterative server, which handles one client at a time, suffer when requests take a long time?

A.Because while it serves one client, all other clients must wait, increasing their response times. ✅
B.Because the server can handle any number of clients simultaneously without delay.
C.Because iterative servers never accept connections.
D.Because iterative servers use only printers.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: An iterative server completes each request before accepting the next. A slow request therefore delays every queued client, which raises response times and limits throughput. This weakness motivates concurrent designs in which several requests can progress at once.

Q9. Why does a concurrent server with a pool of worker threads often reduce response time compared with an iterative server?

A.Because several requests are processed at the same time, so waiting clients are served sooner. ✅
B.Because the threads remove the need for network communication.
C.Because the threads slow the server down to save power.
D.Because the pool stores all requests on a printer.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A worker pool allows several requests to proceed concurrently, so a slow request does not block the others. Waiting clients receive service sooner, improving average response time. The reduction is limited by the number of workers and the available resources, so the pool size is a design trade-off.

Q10. Why does a server need a backlog queue for incoming connection requests?

A.To hold connection requests that arrive while the server is busy, so they are not immediately refused. ✅
B.To store the server's source code.
C.To delete clients that connect too early.
D.To replace the listening socket.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Connection requests can arrive faster than the server accepts them. The backlog holds pending requests in the kernel until the server calls accept, so short bursts are absorbed. When the backlog is full, further requests may be refused or delayed, which signals overload.

Q11. Why does TCP connection setup involve a handshake before data is exchanged?

A.To establish the state and agree on initial parameters so that both ends are synchronised before data flows. ✅
B.To print the address on the screen.
C.To delete the server's port.
D.To avoid any use of the network.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The handshake lets client and server confirm they can reach each other and agree on sequence numbers, which underpins reliable and ordered delivery. Without this synchronisation, data could arrive at an endpoint that is not ready or be misordered, so the handshake is a necessary part of establishing a connection.

Q12. Why must a TCP receiver be prepared to handle partial reads, even when the sender sent one message?

A.Because TCP is a byte stream that does not preserve message boundaries, so one message can arrive split across several reads. ✅
B.Because TCP always sends two messages for each request.
C.Because TCP messages are always larger than the receiver's buffer by design.
D.Because TCP cannot deliver any data to a receiver.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: TCP delivers an ordered stream of bytes, and the boundaries the sender used are not guaranteed to survive. A receiver that assumes one read equals one message will misparse data when a message is split or two combine. Application-level framing is therefore needed to recover message boundaries.

Q13. Why does a stateless server design help a service scale across many replicas?

A.Because any replica can handle any request without storing per-client memory, so load can be distributed freely. ✅
B.Because stateless servers remove the need for any network.
C.Because stateless servers can only serve one client forever.
D.Because statelessness makes requests invisible to the server.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: A stateless server keeps no session data between requests, so each request carries the information it needs. Any replica can therefore serve any client, which makes load balancing and failover simpler. The trade-off is that state must be passed with requests or stored elsewhere when a service needs it.

Q14. A server handles three clients with an iterative design, and each request takes 4 seconds. Client 3 arrives at the same moment as the others. How long does client 3 wait before its service begins?

A.0 seconds
B.4 seconds
C.8 seconds ✅
D.12 seconds
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Clients 1 and 2 are served first, each taking 4 seconds, so client 3 waits 4+4=84 + 4 = 8 seconds before its own 4-second service starts. The sequential nature of the iterative server causes this cumulative waiting, which grows with each queued request.

Q15. A concurrent forking server accepts five clients, forking one child per client, while the parent keeps listening. Including the parent, how many processes exist after all five clients are accepted?

A.5
B.6 ✅
C.10
D.25
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The parent remains as the listener, and each of the five accepted clients causes one child to be created. The total is 1+5=61 + 5 = 6 processes. Forgetting the parent or counting the clients as processes gives the incorrect values in the other options.

Q16. In a request-reply exchange, the network round trip takes 40 ms and the server processing takes 10 ms. What is the total time from sending the request until the reply is received?

A.10 ms
B.40 ms
C.50 ms ✅
D.90 ms
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: The request travels to the server and the reply returns, which is the 40 ms round trip, and the server spends 10 ms processing the request. The total response time is 40+10=5040 + 10 = 50 ms. Adding the processing time to the network time, rather than using only one of them, gives the full picture.

Q17. Which sequence of calls correctly describes the steps a client takes to use a connection-oriented service?

A.socket, connect, send and receive, close ✅
B.listen, accept, send, close
C.bind, listen, socket, connect
D.accept, socket, close, send
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The client first creates a socket, then connects to the server's address, exchanges data with send and receive, and finally closes the connection. The server uses listen and accept instead of connect, so the other sequences mix up the client and server roles or place steps in the wrong order.

Q18. Which call must a server make before it can call accept on a connection-oriented socket?

A.listen ✅
B.connect
C.close
D.send
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The listen call prepares the socket to queue incoming connection requests, and accept can only remove requests from that queue. Calling accept without listen is not valid for a connection-oriented server, so listen is an essential step in the server's sequence of setup calls.

Q19. A server takes 100 ms to process each request and has one worker, so its throughput is 10 requests per second. With four workers working in parallel and no contention, what throughput would you expect?

A.10 requests per second
B.20 requests per second
C.40 requests per second ✅
D.100 requests per second
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Each worker completes 1/0.1=101 / 0.1 = 10 requests per second, so four workers provide 4×10=404 \times 10 = 40 requests per second under ideal conditions. The assumption of no contention is important, since shared resources often limit real gains below the ideal value.

Q20. A client wants a remote function add(2, 3) to be executed using RPC. Which step occurs first?

A.The client stub marshals the arguments into a message. ✅
B.The server returns the result to the client.
C.The server unmarshals the result on the client.
D.The kernel deletes the procedure.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The client-side stub packs the arguments into a message before sending it, since the server cannot begin until it receives the request. The result path, where the server returns a reply, occurs later. Following the order of marshalling, transmission, execution and reply is key to understanding how RPC hides the network.

Q21. A student says that once a server accepts a connection, the listening socket must be closed. What is the error?

A.There is no error, because the listening socket is always closed on accept.
B.The listening socket remains open so that it can accept further connections, while accept returns a new socket for the individual client. ✅
C.Accept deletes the client's address.
D.Listening sockets exist only on printers.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Accept creates a new connected socket for the client and leaves the listening socket in place to keep handling new requests. Closing the listener after the first accept would prevent the server from serving any other client, which would defeat the purpose of a server.

Q22. A student says that TCP preserves message boundaries, so each send always matches exactly one receive. What is the flaw?

A.There is no flaw, because TCP keeps every message intact.
B.TCP delivers a byte stream without preserving sender boundaries, so one send may be split or combined across several receives. ✅
C.TCP never sends any data.
D.Messages are not used in networking.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Because TCP is a stream protocol, the receiver must frame messages itself, for example with length prefixes or delimiters. Assuming that one send equals one receive leads to parsing errors when data arrives in pieces or merged together, which is a common bug in networked programs.

Q23. A student says that the client must know the server's internal implementation to make a remote call. What is the correction?

A.The claim is correct because clients must know internal code.
B.The client needs only the interface, such as the procedure name and parameter types, because the stubs hide the implementation details. ✅
C.Clients never need any information about the server.
D.Clients must write the server's code themselves.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The interface describes what a remote procedure does and what it accepts and returns, while the implementation stays hidden on the server. Stubs use the interface to marshal data, so clients can call remote services without knowing how they are built internally, which supports independent evolution of the two sides.

Q24. A student says that RPC calls always execute on the local machine because the stub hides the network. What is wrong with this reasoning?

A.Nothing is wrong, because stubs run everything locally.
B.The stub hides the network from the programmer, but the procedure executes on the remote server, which is the defining feature of RPC. ✅
C.RPC procedures never run at all.
D.RPC is only used for printers.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The stub gives a local-looking interface, but the actual work happens on the remote machine. The student conflates the appearance of a local call with where execution occurs. Remembering that marshalling carries the request to the remote site is essential for understanding the model, including its failure modes.

Q25. A student says that a concurrent forking server is always faster, so an iterative server is never useful. Which evaluation is most accurate?

A.The claim is correct because forking always gives the best performance.
B.The claim overlooks the cost of creating processes, which can outweigh the benefit for very short requests, so iterative designs remain useful in some cases. ✅
C.Iterative servers cannot run on any system.
D.Forking is only used on printers.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Creating a process has overhead, and for very short requests the cost of forking can exceed the time spent serving the request. An iterative design avoids this overhead and may be adequate for light, fast workloads. The student's universal claim ignores this design trade-off.

Q26. A graph compares average response times for 10 clients: iterative design 50 ms and concurrent design 12 ms. What is the best inference?

A.The concurrent design substantially reduces average response time for this workload. ✅
B.The iterative design is faster for this workload.
C.Response time is unaffected by the server design.
D.Concurrency always increases response time.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The concurrent design's average of 12 ms is much lower than the iterative design's 50 ms, showing that overlapping requests reduces waiting for clients. The inference is specific to this measured workload, but it supports the value of concurrency under similar conditions.

Q27. A graph shows throughput against the number of clients. The iterative design stays flat at 10 requests per second, while the concurrent design rises and then plateaus at about 40 requests per second. What does this suggest?

A.Concurrency raises throughput until some resource saturates, after which adding clients gives little further gain. ✅
B.Throughput is unaffected by adding clients to either design.
C.Iterative servers scale better than concurrent servers.
D.Throughput falls to zero as clients are added.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The concurrent design's rise shows that serving requests in parallel increases total throughput, while its plateau indicates that a resource such as CPU or network becomes the limit. The flat iterative line shows no benefit from additional clients, which matches its one-at-a-time nature.

Q28. A graph shows the number of pending connections in a server's backlog rising to a limit and then new connection attempts being refused. What does this indicate?

A.The server is overloaded, so incoming connection requests exceed what it can queue and accept. ✅
B.The server has no clients at all.
C.The backlog is unlimited and never fills.
D.The client has stopped sending requests.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When pending connections reach the backlog limit, further attempts are refused because there is no room to hold them. This signals that arrivals exceed the server's accept rate, which is the defining symptom of overload. Diagnosing it may require more workers or capacity.

Q29. A graph plots average latency against server load. Latency stays low at light load, then rises sharply as the load approaches capacity. What is the best inference?

A.Queueing delays grow rapidly as the server approaches its capacity, so latency increases sharply near saturation. ✅
B.Latency is unrelated to server load.
C.Latency decreases as load increases without limit.
D.Latency is constant at every load level.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: At low load, requests rarely wait, so latency stays close to the service time. As load approaches capacity, requests spend more time queued, and latency rises steeply. The non-linear shape is the typical signature of queueing behaviour in a client-server system.

Q30. Which combination best describes a remote procedure call that blocks the caller until the reply arrives?

A.A synchronous RPC where the client waits for the remote result before continuing. ✅
B.An asynchronous RPC where the client never receives any result.
C.A local function call with no network involvement.
D.A shared memory copy with no reply.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A synchronous RPC blocks the client until the server's reply returns, which matches the description. The asynchronous option delivers no result, the local call involves no network, and shared memory copying has no reply, so only the first option captures a blocking remote call accurately.

Q31. Which pairing correctly matches a socket operation with its role?

A.connect with the client starting a connection to a server address ✅
B.accept with the client starting a connection to a server address
C.listen with the client sending a file to the server
D.bind with the server deleting a client's connection
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A client calls connect to start a connection to the server's address. Accept belongs to the server and takes a pending connection from the queue, listen prepares the server to receive requests, and bind assigns the address. The other pairings swap these roles, so they are inaccurate.

Q32. A connection-oriented server uses a thread pool with a fixed number of workers and a single listening socket. Which combination describes this design correctly?

A.A concurrent server with a bounded number of workers serving connections accepted from one listener. ✅
B.An iterative server with unlimited processes and no listener.
C.A stateless peer-to-peer broadcast with no connections.
D.A shared memory block with no sockets.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A thread pool with bounded workers serves connections accepted from a single listening socket, which makes it a concurrent server with limited concurrency. The other options describe different architectures, such as iterative designs, peer-to-peer broadcast or shared memory, that do not match the stated combination of listener, pool and connections.

Q33. A server can process requests at a combined rate of 50 per second in total capacity. Requests arrive at 200 per second. What is the server's utilization, expressed as arrivals divided by capacity?

A.25 percent
B.50 percent
C.400 percent ✅
D.This value cannot be computed from the data.
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Utilization is the ratio of arrival rate to capacity, here 200/50=4200 / 50 = 4, or 400 percent. A value above 100 percent means the server cannot keep up, and queues grow without bound, which is why capacity planning must ensure arrivals stay below the service rate.

Q34. A client connects to a server, which takes one round-trip time of 50 ms to establish the connection. The client then sends a request and receives the reply after another round trip of 50 ms, ignoring processing time. How long does the client wait from starting the connection until the reply arrives?

A.50 ms
B.100 ms ✅
C.150 ms
D.200 ms
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Connection establishment takes one round trip of 50 ms, and the request and reply take a second round trip of 50 ms. The total is 50+50=10050 + 50 = 100 ms. Counting each round trip separately, and not merging them, is the key step in this multi-step timing problem.

Q35. Why are idempotent operations easier to retry after a timeout in a request-reply protocol?

A.Repeating an idempotent operation gives the same outcome, so a retry cannot corrupt the server's state. ✅
B.Retries delete the reply that the server sent earlier.
C.Timeouts never occur in request-reply systems.
D.The server stops listening after every timeout.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When a reply is lost, the client cannot tell whether the server executed the request. If the operation is idempotent, executing it again produces the same result, so the retry is safe. Non-idempotent operations, such as charging an account twice, need extra safeguards, so this property is central to reliable client-server design.

🔗 Related Topics (MCQs)