Interview Question

What is multi-threading in C?

C threads can share process memory, so shared state needs proper synchronization.

💡 Concept ✅ Quick Revision ⚙ C

Answer

Multithreading runs multiple threads of execution within one process. • C provides a standard thread library in `<threads.h>`, while POSIX systems also provide pthreads. • Shared non-atomic data requires synchronization to avoid data races. • Thread availability and platform APIs vary by implementation.

💡 C Example

#include <threads.h> int worker(void *argument) { int *value = argument; *value = 42; return 0; }

⚡ Quick Revision

C threads can share process memory, so shared state needs proper synchronization.