- 5% Extra
Credit: instead of Canvas, submit your assignment via https://education.github.com/ (MUST
be private, invite swirsz) I will use Github’s last modified date as the
submission date. Make sure to put your full name in the header of your
file.
- 10% Extra
Credit: Your print output may occasionally be garbled. How would you fix this? (Hint: Semaphores implemented as pipes – see
below) Separate program operations and print statements as best as possible.
Consider the printf statements as a critical section. Do not use delays or wait inside your main
loop, or make child processes wait in any way.
- 10% Extra
Credit: Use the output from stat to determine the owner of the file, and then use the passwd structure on the owner of the file to determine the
home directory of the user that owns that file.
(example below)
Last Revised: February 26, 2017
$ gcc Lab3.c -o Lab3 && ./Lab3 .. Lab3.c
File: ..
Directory: /root
You have general permissions: read execute
File: Lab3.c
Directory: /home/users15/sew25545
You have owner permissions: read write execute
Hint for Semaphores implemented as pipes:
void V(int pd[]) {
int a=1;
write(pd[1],&a,sizeof(int));
}
void P(int pd[]) {
int a;
read(pd[0],&a,sizeof(int));
}