Quick Contact

✉
fahimkhan20148@gmail.com
📱
+971 507 286 133
Back to Notes
August 18, 2026
concurrencythreads

Threads

Every program starts with one OS thread, and the thread remains alive as long as the program runs. Once the program stops executing, the thread is cleaned up.

When the main thread is terminated, all threads forked or spawned from it are also cleaned up, whether they have finished executing or not.