Minitalk is a UNIX inter-process communication (IPC) project that demonstrates mastery of systems programming through signal-based message transmission. The project implements a robust client-server architecture where text messages are encoded bit-by-bit and transmitted using only SIGUSR1 and SIGUSR2 signals—no sockets, pipes, or shared memory required.
- Binary message encoding: 8 bits per character
- Multi-client support: Handles up to 500 concurrent clients simultaneously
- Acknowledgment protocol: Client-server handshake ensures reliable transmission
- Timeout mechanism: Prevents deadlocks from unresponsive processes
- Clean memory management: No leaks, proper resource cleanup
- Modular library integration: Uses custom
libftstatic library - Bonus version with enhanced functionality
| Category | Technology |
|---|---|
| Language | C (C99 standard) |
| IPC Mechanism | Unix Signals (SIGUSR1, SIGUSR2) |
| System Calls | kill(), pause(), sigaction(), usleep() |
| Build System | Makefile with dependency tracking |
| Library | libft - Custom C standard library |
The decision to use Unix signals for IPC instead of traditional sockets or pipes addresses a fundamental systems programming challenge: minimal overhead communication between processes. Signals operate at the kernel level, requiring no buffer allocation or file descriptors. Each character is decomposed into 8 bits and transmitted sequentially where SIGUSR1 represents bit 1 and SIGUSR2 represents bit 0. The acknowledgment protocol (server echoes SIGUSR1 per bit received) ensures synchronization without race conditions, while static arrays manage client state across multiple concurrent connections—a pattern demonstrating practical understanding of process isolation and signal-safety constraints.
flowchart TD
subgraph Client["CLIENT PROCESS"]
A[Start] --> B[Parse PID + Message]
B --> C[Encode Character to Bits]
C --> D{Each Bit}
D -->|Bit = 1| E[Send SIGUSR1]
D -->|Bit = 0| F[Send SIGUSR2]
E --> G[Wait for ACK]
F --> G
G --> H{ACK Received?}
H -->|Yes| I[Next Bit]
H -->|Timeout| J[Resend Bit]
I --> D
J --> D
end
subgraph Server["SERVER PROCESS"]
K[Start] --> L[Print PID + Listen]
L --> M[Signal Handler]
M --> N{New or Known Client?}
N -->|New| O[Register Client]
N -->|Known| P[Update Client Buffer]
O --> P
P --> Q{8 Bits Received?}
Q -->|No| R[Send ACK SIGUSR1]
Q -->|Yes| S{Null Terminator?}
S -->|No| T[Append to String]
S -->|Yes| U[Print Message + Clean]
T --> R
U --> V[Release Client Slot]
R --> M
end
Client -.->|kill PID SIGUSR1/SIGUSR2| Server
Server -.->|kill PID SIGUSR1 ACK| Client
- GCC or Clang compiler
- Make build tool
- Unix-like system (Linux/macOS)
git clone https://github.com/samuelhm/Minitalk.git
cd Minitalk
makeThis compiles both server and client executables. For the bonus version:
make bonusTerminal 1 - Start the server:
./server
# Output: Server PID: <PID>Terminal 2 - Send a message:
./client <SERVER_PID> "Your message here"Run the provided test script for sequential and async tests:
./server &
./test.shMinitalk/
├── Makefile # Build configuration
├── include/
│ ├── minitalk.h # Main header
│ └── minitalk_bonus.h# Bonus header
├── src/
│ ├── server.c # Server implementation
│ ├── client.c # Client implementation
│ ├── server_bonus.c # Bonus server
│ └── client_bonus.c # Bonus client
├── lib/
│ └── libft/ # Custom C library (submodule)
└── test.sh # Test script
| Platform | Link |
|---|---|
| GitHub | github.com/samuelhm |
| linkedin.com/in/shurtado-m |
Built as part of the 42 Barcelona curriculum