What is the difference between a process and a thread?

后端 未结 30 2212
Happy的楠姐
Happy的楠姐 2020-11-22 00:39

What is the technical difference between a process and a thread?

I get the feeling a word like \'process\' is overused and there are also hardware and software threa

30条回答
  •  星月不相逢
    2020-11-22 01:05

    Threads within the same process share the Memory, but each thread has its own stack and registers, and threads store thread-specific data in the heap. Threads never execute independently, so the inter-thread communication is much faster when compared to inter-process communication.

    Processes never share the same memory. When a child process creates it duplicates the memory location of the parent process. Process communication is done by using pipe, shared memory, and message parsing. Context switching between threads is very slow.

提交回复
热议问题