Programmers can answer all existential questions with ease

raubarno
link
fedilink
311Y

If you fork a process, then it’s the two separate processes but sharing the same memory with copy-on-write mapping.

Is that actually more efficient if I need my child process to do something different with different data?

raubarno
link
fedilink
71Y

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).

Ah thx for the info

@dan@upvote.au
link
fedilink
3
edit-2
1Y

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.

deleted by creator

Create a post

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.
  • 1 user online
  • 64 users / day
  • 250 users / week
  • 420 users / month
  • 2.88K users / 6 months
  • 1 subscriber
  • 1.53K Posts
  • 33.9K Comments
  • Modlog