Concurrency and Multithreading

后端 未结 9 720
情书的邮戳
情书的邮戳 2020-12-23 23:03

I\'m not very experienced with subjects such as Concurrency and Multithreading. In fact, in most of my web-development career I had never needed to touch these subjects.

9条回答
  •  渐次进展
    2020-12-23 23:44

    To fork is human to thread is divine :D

    Forking involves the kernel and creates a seperate adress space -- meaning proc X and Y can't easily share and need to use IPC primitives, and creating a thread allows in process synchronization which is FAR faster than IPC which involves kernel context switches by both processes and needless thread yield's (which involve the kernel to wake said thread up).

    However there is a multitude of reasons why different concurrency models are better than others. I'm just giving you the rough rule of thumb for general programming. For example not forking might endanger logic which could be separated out by forking (I love that word) -- endangered because if the other logic in the process crashes it , well said logic is going down with the process.

提交回复
热议问题