Exam 06 [repack] - 42

Column title

Provided Boilerplate

: The exam usually provides a main.c with about 80 lines of networking setup (socket creation, binding, and listening) to help you get started.

Q2: What happens if my program crashes after the time limit?

  1. Rewrite minishell signal handling from scratch. Do it without copying your old code. Focus on sigaction() with SA_RESTART vs. without.
  2. Complete the philosophers project with threads and mutexes, but then rewrite it using processes and signals only. This forces you to learn IPC.
  3. Master sigaction structure:
    struct sigaction sa;
    sa.sa_handler = &handler;
    sigemptyset(&sa.sa_mask);
    sa.sa_flags = SA_RESTART; // prevents EINTR on read/write
    sigaction(SIGUSR1, &sa, NULL);
    

4. Getting the Current Time (gettimeofday())

  • Using system(3) or any function that spawns a shell.
  • Using fork(2) and execve(2) is mandatory for external commands.
  • Using printf for debugging (the grader checks output exactly).
  • Memory leaks (strictly forbidden – any leak fails the exam).

, a daunting test of a student’s mastery over low-level system programming, network protocols, and concurrent processing. Unlike traditional academic assessments, Exam 06 is a solitary battle against a terminal, requiring the construction of a functional mini-IRC (Internet Relay Chat) server from scratch. The Technical Core: Select and Sockets The heart of Exam 06 lies in the 42 Exam 06