Exercises

   


11.1 What limitation in the use of pipes inspired the developers to design alternative interprocess-communication facilities?

11.2 Why are the FreeBSD interprocess-communication facilities designed to be independent of the filesystem for naming sockets?

11.3 Why is interprocess communication layered on top of networking in FreeBSD, rather than the other way around?

11.4 Would a screen editor be considered a naive or a sophisticated program, according to the definitions given in this chapter? Explain your answer.

11.5 What are out-of-band data? What types of socket support the communication of out-of-band data? Describe one use for out-of-band data.

11.6 Give two requirements that interprocess communication places on a memory-management facility.

11.7 How many mbufs and mbuf clusters would be needed to hold a 3024-byte message? Draw a picture of the necessary mbuf chain and any associated mbuf clusters.

11.8 Why does an mbuf have two link pointers? For what is each pointer used?

11.9 Each socket's send and receive data buffers have high and low watermarks. For what are these watermarks used?

11.10 Consider a socket with a network connection that is queued at the socket awaiting an accept system call. Is this socket on the queue headed by the so_comp or by the so_incomp field in the socket structure? What is the use of the queue that does not contain the socket?

11.11 Describe two types of protocols that would immediately place incoming connection requests into the queue headed by the so_comp field in the socket structure.

11.12 How does the protocol layer communicate an asynchronous error to the socket layer?

11.13 Sockets explicitly refrain from interpreting the data that they send and receive. Do you believe that this approach is correct? Explain your answer.

11.14 Why does the sosend() routine ensure there is enough space in a socket's send buffer before making a call to the protocol layer to transmit data?

11.15 How is the type information in each mbuf used in the queueing of data at a datagram socket? How is this information used in the queueing of data at a stream socket?

11.16 Why does the soreceive() routine optionally notify the protocol layer when data are removed from a socket's receive buffer?

11.17 What might cause a connection to linger forever when closing?

11.18 Describe a deadlock between two processes, A and B, that are sharing two semaphores, S1 and S2.

11.19 How can a message queue be used to implement a priority queue? How can it be used to allow full duplex communication?

11.20 Why doesn't the shmdt system call free the underlying shared memory?

*11.21 What effect might storage compaction have on the performance of network-communication protocols?

**11.22 Why is releasing mbuf-cluster storage back to the system complicated? Explain why it might be desirable.

**11.23 In the original design of the interprocess-communication facilities, a reference to a communication domain was obtained with a domain system call,

 int d; d = domain("inet"); 

(where d is a descriptor, much like a file descriptor), and sockets then were created with

 s = socket(type, d, protocol); int s, type, protocol; 

What advantages and disadvantages does this scheme have compared to the one that is used in FreeBSD? What effect does the introduction of a domain descriptor type have on the management and use of descriptors within the kernel?

**11.24 Design and implement a simple replacement for Local IPC semaphores that operates on a single semaphore instead of an array. The new system should adhere to the original API to the extent that it should implement a semget, semctl, and semop routine.


   
 


The Design and Implementation of the FreeBSD Operating System
The Design and Implementation of the FreeBSD Operating System
ISBN: 0201702452
EAN: 2147483647
Year: 2003
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net