Midterm Information: --- Format: Short answer questions (55 points) and long answer questions (3 questions, 45 points). At least two of the long answer questions are related to Assignment 1 and Assignment 2. Short answer question examples: 1) Write a code segment to block SIGINT and SIGUSR1 2) What is the content in file mytmp after the following code segment is executed? f1 = open ("mytmp", O_RDWR | O_CREAT, 0777); f2 = open ("mytmp", O_RDWR | O_CREAT, 0777); write(f1, "2222", 4); write(f2, "1111", 4); close(f1); close(f2); A long answer question example: In the mymake program, the dependencies specified in the makefile must be honored. Write the code (or very detailed pseudo-code) that enforces the dependencies. Specify your assumptions and data structures. ---- Most questions are related to coding: writing code segments to achieve certain tasks or predicting the output of a code segment (UNIX concepts are embedded in such questions). ---- Content: Lecture 1 to Lecture 8 Lecture 2: General C/C++ programming and UNIX concepts - gcc flags to enforce C/C++ standards - makefile - directives to protect C/C++ header files - C/C++ macros with parameters - command line arguments - environ variable, getenv Lecture 3: Process management fork, exit, wait, waitpid, execv family routines their semantics, how to use them, parent/child synchronization zombie process, orphane process, various ids Lecture 4: File operations and pipes Data structure related to file operations open, dup, read, write semantics and how to use them I/O redirection, what is it and how to code unname pipes: pipes - semantics and how to use it how to implement the pipe in shell Lecture 5: File meta data and directories The data structure storing file meta data, understand the fields file type, set-user-ID and set-group-ID, access permission, hard link and symbolic link, file time, random access directory operations stat, umask, remove, rename, link, unlink, symlink, readlink, lseek opendir, readdir, closedir, rewinddir Lecture 6: Signal and terminal IO Common signals, block/unblock/caatch signals, set signal handler sigprocmask, sigaction, kill, alarm Terminal IO: canonical and noncanonical mode of input, how to set to a particular mode? tcgetattr, tcsetattr Lecture 7: Job control and process relationship UNIX process relationship: session/group process Job control: what does it do? foreground and background processes getpgrp, setpgid, setsid, tcgetpgrp, tcsetpgrp Lecture 8: Inter-process communication message queues, shared memory, semaphores What are they? and the related system calls to create, use, and destroy them.