Process are divided into OS threads

Tags: programming threads

OS-level threads are lightweight processes that share memory within a larger process context. A process can contain multiple OS-level threads and the operating system's scheduler will switch between these threads.

OS-level threads are much harder to do correctly because there are no guarantees from the scheduler when the thread context will be switched (possibly leaving you with an incomplete data structure or a bad state).

OS-level threads differ from green threads in that they are managed by the operating system instead of by the language's runtime.