Question 1

Report the differences among types of exec*(execl, execvp, ...) and system system calls.

  • Hint: use man!

Question 2

There are multiple sub-folders in the question2 directory each of which uses a type of exec system call and includes 2 C codes. First, add codes to p2.c files to execute p1 using the name of sub-folders. Second, print the time before and after running p1. Discuss the results considering your report from question 1.

  • Hint: use gettimeofday().

Question 3

Write 2 programs in C, showing the difference between wait and waitpid.

Question 4

A web server is an application which can handle requests over the web. One of the characteristics that a web server should have is capable of responding to many clients within the low latency. E.g. consider Google as a web server which millions of clients can get their response simultaneously. A very simple web server program is attached to this homework. This web server only could response to clients one by one. Modify this program to address this issue.

  • Step 1: Compile and Run the server.c
  • Step 2: In your browser: http://localhost:8090/
  • Step 3: Add fork to server.c; Then goto step 1.
  • If you get the error: In bind: Address already in use try to change PORT number in the file and then recompile and run.

Deadline

  • Friday 25th Oct. 23:55
  • The submission after this time will not be accepted with no exception.

Submission

Submit a zip file to lms. The file should be named as your-student-number.zip. E.g. 96521234.zip. The file should contain a document, containing solutions for all questions in pdf and all the codes you have written.