由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - multithreaded vs multiprocess
相关主题
multi threading 还是 multi processingopenMP or boost::thread (pthread) for multithreading ?
来来,讨论一下multithread, multi-core, affinitya dummy OS question
when should use multiprocess not multithread: embedded mult (转载)python的muti process和multi threading有啥优劣?
请教c++ multithreading入门问题如果一个core,多线程还有必要吗?
学习multi threading, 有什么好书?问一个python multiprocessing问题
请问比较好的multithread和multiprocess编程的书请推荐几本Multi-threading的编程书籍
一个multithread的问题(是不是有人觉的很简单?)[合集] 请推荐几本Multi-threading的编程书籍
multithread app的design要注意哪些问题?有专门介绍multithreading编程的书吗
相关话题的讨论汇总
话题: process话题: multi话题: thread
进入Programming版参与讨论
1 (共1页)
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,通过一定方式交流信息。 比如电池管理模块,即使出了故障,不会影响
其它模块的工作。
1 (共1页)
进入Programming版参与讨论
相关主题
有专门介绍multithreading编程的书吗学习multi threading, 有什么好书?
急问一个学Multithreading编程的问题请问比较好的multithread和multiprocess编程的书
多线程计时不准std::thread尝鲜 问题一个multithread的问题(是不是有人觉的很简单?)
C++ timer class for multithreads?multithread app的design要注意哪些问题?
multi threading 还是 multi processingopenMP or boost::thread (pthread) for multithreading ?
来来,讨论一下multithread, multi-core, affinitya dummy OS question
when should use multiprocess not multithread: embedded mult (转载)python的muti process和multi threading有啥优劣?
请教c++ multithreading入门问题如果一个core,多线程还有必要吗?
相关话题的讨论汇总
话题: process话题: multi话题: thread