All programming should be done in C/C++. Java programs will NOT be considered for evaluation.
  1. Communication using named pipes:

  2. Process A creates a named pipe and spawns a child process B. A opens the pipe for writing and B opens it for reading. A writes to the pipe a set of UNIX commands (read in from another file) one at a time. B executes each of these commands and writes the output to another file on the disk. Your program should take as input a filename from which the commands are to be read in and another filename to which the output should be written.

  3. Matrix multiplication using message queues:

  4. Consider an mxp matrix and a pxq matrix. The product of these matrices is an mxq matrix. The element at location (i,j) in this matrix is the sum of product of the elements on the ith row of the first matrix and the jth row of the second matrix.

    In the multiprocess version of matrix multiplication, each element in this matrix is generated by a separate process.

    The main process creates mxq processes, each of which communicates with the main process using a message queue. Each (i,j)th child process computes the corresponding element (i,j are passed as command line arguments to each child process) and places the results in a message queue for the main process to retrieve. After this the child process exits. The main process waits for completion of all the child processes, reads the elements from the message queue and prints the output in the following form.

    Matrix A:
    1 0 -2
    0 3 1

    Matrix B:
    0 3
    -2 -1
    0 4

    Matrix AB is:
    0 -5
    -6 1

  5. A client server program:
    (Multithreaded socket programming, use pthreads)

  6. The server has two text files, one containing user ids with passwords and the other with user name and exam marks. A client connects to the server, and authenticates itself using an userid and its password. The client provides an exam number to which the server responds with the client's marks for the particular exam and the class average for that exam. The server should be capable of handling multiple clients.
Resources for this assignment:
  1. Programming in C
  2. Beej's Guide to Network Programming
  3. Unix Network Programming by W. Richard Stevens