this post was submitted on 14 Oct 2023
849 points (98.7% liked)
Programmer Humor
32453 readers
989 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
It's more efficient for memory until you start working with different data. Threads also rely on the same syscall on Linux, clone(2), but they don't share the entire context by default, so they're more lightweight. It is recommended to use pthreads(3) API instead of fork(2).
Also, if you care about Windows, threads are far lighter than processes on that platform. Starting a new process is relatively slow compared to other platforms.
Ah thx for the info