l*********s 发帖数: 5409 | 1 To package functionalities into modules, you can employ either approach, but
what are the pros and cons? (if creation subprocess/threads is only done
during initialization)
And on servers,does it matter that a process requires more resource than
thread, if I am mostly concerned about performance only? |
t****t 发帖数: 6806 | 2 Thread share memory, process don't. but you can apply shared memory through
OS.
If nothing needs to be shared, process wins because you don't need to worry
about race conditions. otherwise thread wins.
Context switching between process is of course, slower (since you need to
switch memory mapping as well).
but
【在 l*********s 的大作中提到】 : To package functionalities into modules, you can employ either approach, but : what are the pros and cons? (if creation subprocess/threads is only done : during initialization) : And on servers,does it matter that a process requires more resource than : thread, if I am mostly concerned about performance only?
|
l*********s 发帖数: 5409 | 3 Got it, many many thanks!
through
worry
【在 t****t 的大作中提到】 : Thread share memory, process don't. but you can apply shared memory through : OS. : If nothing needs to be shared, process wins because you don't need to worry : about race conditions. otherwise thread wins. : Context switching between process is of course, slower (since you need to : switch memory mapping as well). : : but
|
g*****g 发帖数: 34805 | 4 thread->performance
process->reliablity
If you are concerned on performance, there's no reason to go to
multi-process.
but
【在 l*********s 的大作中提到】 : To package functionalities into modules, you can employ either approach, but : what are the pros and cons? (if creation subprocess/threads is only done : during initialization) : And on servers,does it matter that a process requires more resource than : thread, if I am mostly concerned about performance only?
|
a9 发帖数: 21638 | 5 process是自动创建内存拷贝吧?
through
worry
done
【在 t****t 的大作中提到】 : Thread share memory, process don't. but you can apply shared memory through : OS. : If nothing needs to be shared, process wins because you don't need to worry : about race conditions. otherwise thread wins. : Context switching between process is of course, slower (since you need to : switch memory mapping as well). : : but
|
c*****a 发帖数: 808 | 6 i like shared memory than msg passing...run faster |
h**********c 发帖数: 4120 | 7 but one crashed, all crash.
【在 c*****a 的大作中提到】 : i like shared memory than msg passing...run faster
|
w*********u 发帖数: 392 | 8 process crashing will bring down all threads within, this is a major risk of
multi-threading.
multi-process leaves many of the management tasks to OS, which in most cases
is a better solution.
multi-threading relies on the application(thus you the programmer) to
maintain clean state and guard shared resource.
Context switching is happening regardless it is multi-threading or multi-
process. CPU can do one at a given time anyway. Shared resource is the
primary consideration.
【在 h**********c 的大作中提到】 : but one crashed, all crash.
|
p*a 发帖数: 592 | 9 one thing to consider is memory constraint. if each process needs to cache
a lot of stuff in memory, you may not have enough memory to run multiple
processes.
of
cases
【在 w*********u 的大作中提到】 : process crashing will bring down all threads within, this is a major risk of : multi-threading. : multi-process leaves many of the management tasks to OS, which in most cases : is a better solution. : multi-threading relies on the application(thus you the programmer) to : maintain clean state and guard shared resource. : Context switching is happening regardless it is multi-threading or multi- : process. CPU can do one at a given time anyway. Shared resource is the : primary consideration.
|
d***q 发帖数: 1119 | 10
if you use shared memory heavily, it is better to use multi-thread directly.
【在 c*****a 的大作中提到】 : i like shared memory than msg passing...run faster
|
l*********s 发帖数: 5409 | 11 process context switching is more expensive since caching is flushed. This
does not happen in thread switching.
of
cases
【在 w*********u 的大作中提到】 : process crashing will bring down all threads within, this is a major risk of : multi-threading. : multi-process leaves many of the management tasks to OS, which in most cases : is a better solution. : multi-threading relies on the application(thus you the programmer) to : maintain clean state and guard shared resource. : Context switching is happening regardless it is multi-threading or multi- : process. CPU can do one at a given time anyway. Shared resource is the : primary consideration.
|
O*******d 发帖数: 20343 | 12 Multi process比较安全。 很多医学诊断治疗仪器用multi process。 不同的模块有自
己的process,通过一定方式交流信息。 比如电池管理模块,即使出了故障,不会影响
其它模块的工作。 |