ECSE-2660 Computer Architecture, Networks, & Operating Systems, Spring 2003 Page 1 of 1In-Class Activity #20 (Solution)4/9/2003 12:04 PM Activity 20.1 Inter-process communication a. How is a pipe implemented? The two processes share a FIFO (first-in, first-out) buffer. b. What would happen if a pipe were implemented using a LIFO (last in, first out) buffer? The data would be scrambled! In the worst case, the second process would receive what it expects in reverse order. c. Rewrite the equivalent of the UNIX command diff file1 file 2using a pipe. cat file1 | diff file2 (the first parameter of diffis replaced by the pipe). d. Can there be two-way communication over a single pipe? Explain your reasons. No. A FIFO buffer or queue is essentially unidirectional. e. What is a file descriptor? How many bits does it contain? A file descriptor is an integer-valued index into a table of open files (for a specific process). This table contains the file name, status, user rights, and the current location of the read and write pointers. The table itself is part of the PCB. The
This is the end of the preview.
access the rest of the document.