TwistedBlizzard
TwistedBlizzard

Reputation: 1006

How does std::thread generate concurrent processes on the OS?

I'm interested in implementing a thread class, purely as a learning exercise. What is the interface that std::thread uses to be able to run/stop concurrent processes on an OS? Is there a standard interface? Otherwise, what do I need to use for Windows 11?

Upvotes: 1

Views: 122

Answers (1)

Henrique Bucher
Henrique Bucher

Reputation: 4474

On Linux, std::thread is just a thin wrapper around the pthreads library, which in its turn is based on the C standard library (glibc). I actually do not use std::thread because it lacks a ton of features eg setting core affinity. I usually write my own thread class, which is simple enough.

Here is an interesting tutorial on getting started with pthreads:

https://riptutorial.com/pthreads

The reference should have been already installed on your system:

https://man7.org/linux/man-pages/man7/pthreads.7.html

Upvotes: 2

Related Questions