4.7 KiB
Drills — the actual training
Every drill is written from a blank file, by hand, no copy-paste. Timer on. Report card
at the bottom. R = red (failed / looked) · Y = yellow (done but slow) · G = green (clean, on time).
D1 — Requirement recall · 20 min · day 1
Close everything (including this file). Write the 11 ground-truth behaviors of the exam from
memory (start from the README list mentally; do NOT open it). Then compare with README
"ground truth". Every line you missed → mark it on the traps list in cheatsheet.md.
Green = all 11, in order, no peeking.
D1.5 — Fundamentals sprint · 45 min · day 1 (optional, very recommended)
Read fundamentals.md §1–§8 while running the four experiments in explore/ (they make
fds, backlog, chunking and select visible). Then read §10 — the "how to test each part of
your code" table — and keep debugging.md §5 (symptom table) open from now on.
Timebox: 45 minutes. If you're behind schedule, do §4, §5, §7 + experiments 02, 03 only.
D2 — Boilerplate blast · 15 min ×3 · day 1
Blank file. Type, without notes:
- includes,
t_clientstruct, globals (g_c,g_maxfd,g_server,g_next_id),fatal() main: argc guard with the exact string, socket/bind/listen withhtonl(2130706433)- init all slots, then the loop: rebuild
fd_set→select→accept-only handling
Compile clean: cc -Wall -Wextra -Werror file.c -o test. It doesn't have to work yet — just be
typed from memory. Repeat 3 times; target the last one under 8 minutes.
Green = third run < 8 min, compiles clean, zero peeks.
D3 — Buffer brains · 10 min ×2 · day 1
Blank file. Type str_join + extract_message from subject/main.c (they're given in the exam —
this is fluency training). Then, from memory, type handle_read() that uses them:
recv → append → extract loop → sprintf("client %d: %s") → free.
Then a paper check on these cases — what is buffered, what is relayed?
| input chunks (in order) | relayed lines |
|---|---|
"ab\ncd\n" |
? |
"ab" then "cd\n" |
? |
"a\nb" then "c\n" |
? |
"lonely" then disconnect |
? |
Green = code compiles + all four cases answered correctly.
D4 — Arrivals & departures · 25 min · day 2
Take D2's file and complete it: accept_new (ids, maxfd, "just arrived" to others only),
disconnect (left message, slot cleanup, maxfd shrink), to_all_except.
Test with two nc windows: connect/leave order, ids 0,1,2…, newcomer receives nothing on connect.
Green = all of the above verified with nc.
D5 — Full attempt #1 · 60–90 min · day 2+
Blank file. Timer. No internet, no notes, vim only. Write the whole program. Then:
bash tester/check.sh
Then diff against reference/mini_serv.c and write your "what I missed" list (function by
function, be honest). That list is your study plan for the next session.
Green = check.sh fully green.
D6 — Full attempt #2, faster · ≤90 min · day 3+
Same as D5 but the target is ≤ 90 min, all green. If you red anything, do the smallest targeted drill for the weak part and run D6 again the same day.
Green = ≤90 min, all green.
D7 — Chaos hour · 30 min · day 4
Make the tester try to break you:
python3 tester/mini_serv_tester.py sandbox/mini_serv # everything
python3 tester/mini_serv_tester.py sandbox/mini_serv --quick # quick loop
Add your own abuse: two servers on one port (→ Fatal error), a client that sends 300 KB and
disconnects mid-line, 20 clients at once, printf-free stderr. Read every failure message
slowly — those messages are written the way the real grader thinks.
Green = all 13 tests pass and you can explain any red to yourself.
D8 — Exam simulation · 2 h · day 5+
Fresh empty directory (mkdir /tmp/opencode/examsim && cd /tmp/opencode/examsim). Simulate
everything: only the subject (subject/subject.en.txt) + subject/main.c open in another tab
(like the exam attachment), vim, 2 hours, no other references. When done, copy your file to
sandbox/rendu/mini_serv/mini_serv.c and run bash tester/check.sh.
Green = all green within the 2 h. Two consecutive D8 greens = you're ready.
Report card
| Drill | Run 1 | Run 2 | Run 3 | Notes |
|---|---|---|---|---|
| D1 | ||||
| D2 | ||||
| D3 | ||||
| D4 | ||||
| D5 | ||||
| D6 | ||||
| D7 | ||||
| D8 |
Readiness rule (repeat until true)
Two consecutive full attempts from a blank file, under 2 h, all green = ready. Then stop drilling the full thing; do D2/D3 once a day to stay warm until exam day.