1/17
A set of flashcards covering multi-process, multi-threaded, and IO multiplexing server models, as well as relevant system calls and best practices for network programming.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What was the median score reported for assignment two so far?
The median so far is 63 out of 75.
When is assignment two officially due?
Thursday at 3PM.
Which system call is used to indicate a server's willingness to accept connections?
The listen system call.
What is the difference between the return values of the listening file descriptor and the connected file descriptor?
The listening file descriptor is used to accept connections, while the accept system call returns a new connected file descriptor for communicating with a specific client.
What are the three approaches discussed for handling multiple clients simultaneously?
1. The multi process approach, 2. The multi threaded approach, and 3. The IO multiplexing approach.
In a multi process server, what must the parent process do to avoid creating zombies?
The parent must reap dead children by calling a function like wait PID.
What is the purpose of the SA restart flag in the SIG action structure?
It ensures that the accept system call automatically restarts itself if it is interrupted by a signal, such as a sick child signal.
Why is it important for the parent process to close its copy of the connected file descriptor after a fork?
Otherwise, the program will never be able to detect end of file on that descriptor, similar to issues encountered with pipes.
Which function is used to retrieve the address details of a port for listening?
get ADR info.
What does the function INET N2A do?
It turns a network byte ordered integer into an ASCII or application representation of an IP address.
What is the function of the d print f call?
It is like f print f, but it takes a file descriptor as its first argument instead of a file pointer.
Which P thread function is used to mark a thread so its resources are reclaimed automatically upon termination?
pthread detach.
What is a significant disadvantage of the multi process approach compared to multithreading?
It is very difficult to share data between processes, requiring the use of pipes or shared memory.
In the IO multiplexing approach with poll, what does the POLLIN event indicate?
It indicates that there is data to read on the file descriptor (or for a listening socket, that a connection request has arrived).
What is the high-performance Linux-specific notification mechanism that handles large numbers of file descriptors more efficiently than poll?
ePoll.
What socket option allows a server to immediately reuse an address after the program is killed?
The SO reuse address socket option.
What specific flag should be used with wait PID in a signal handler to ensure the call returns immediately rather than blocking?
WNOHANG.
Why might a high-performance server terminate itself periodically and restart?
To avoid resource consumption from potential memory leaks.