Inter-process communication using only UNIX signals — encoding data at the bit level.
"This project taught me how processes communicate at the OS level — using signals, PIDs, and bitwise operations. I understood what IPC (Inter-Process Communication) really means, a concept present in every operating system, distributed system, and even container orchestration platform."
Signal-based IPC is foundational knowledge for understanding how processes coordinate in Unix-like systems — the backbone of every Linux server in production today.
Two separate programs communicate exclusively through UNIX signals (SIGUSR1 and SIGUSR2):
CLIENT SERVER
| |
| --- SIGUSR1 (bit = 1) ------> |
| --- SIGUSR2 (bit = 0) ------> |
| --- SIGUSR1 (bit = 1) ------> |
| ... 8 signals ... |
| | assembles byte → prints character
| <-- SIGUSR1 (acknowledgment) |
SIGUSR1represents bit1SIGUSR2represents bit0- Each character is transmitted as 8 signals (one per bit)
- The server reconstructs bytes using bit-shift operations
- On null character received, the server sends back an acknowledgment signal
The bonus version adds acknowledgment signals from server to client after each character, ensuring reliable delivery.
The signal handler uses sigaction with SA_SIGINFO instead of the simpler signal() function. This allows the server to read info->si_pid — the PID of the sending process — directly from the signal metadata, without any shared global state or additional communication channel. A clean, professional approach to handling signals in C.
git clone https://github.com/gustavofsousa/minitalk_42.git
cd minitalk_42
makeStart the server first:
./server
# Output: PID: 12345Send a message from the client:
./client 12345 "Hello, World!"make bonus
./server_bonus
./client_bonus <PID> "Your message here"minitalk_42/
├── server.c # Signal receiver — assembles and prints messages
├── client.c # Signal sender — encodes and transmits strings
├── server_bonus.c # Server with acknowledgment
├── client_bonus.c # Client with acknowledgment
├── libft/ # Personal C library (dependency)
└── Makefile
- UNIX signals (
SIGUSR1,SIGUSR2,sigaction,kill,pause) - Bitwise operations for encoding/decoding data
- Inter-Process Communication (IPC)
- Process identification (PID)
- Reliable communication protocols design
This project was developed as part of the 42 School curriculum.
Made with ☕ at 42 Rio de Janeiro