Tasks
Write or fix a program. What grades it is the kernel's own record of what happened — the process table, the fd tables, the trace, the exit status and what was left behind — and not a reading of what you wrote.
- Read a file without leaving it openDescriptors · warm-up · 3 min
Read the first eight bytes of /work/data and exit cleanly. When the process ends it must be holding nothing but the terminal — no file, no stray descriptor.
- Leave no zombiesProcesses · warm-up · 4 min
Fork two children. Each should exit immediately. Your process must end with none of them left in the process table.
- The subprocess call that hangsDescriptors · real · 8 min
The child writes a hundred kilobytes to a pipe and the parent waits for it to finish before reading. It never finishes. Fix it so both processes end, without changing what the child writes.
- Open it, do not ask about itDescriptors · real · 5 min
Open /work/data for reading and handle the failure if it is not there. Do it without asking first whether it exists.
- Put a file on standard outputDescriptors · real · 6 min
Write the word
helloto /work/out — but the write must be to descriptor 1, exactly as a program that knows nothing about the file would do it.