多线程:关键部分 [英] Multithreading: critical section

查看:98
本文介绍了多线程:关键部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么不能在整个过程中使用关键部分?

在此先感谢

Why critical section cannot be used across process?

Thanks in advance

推荐答案

因为批评部分只是定义过程中的关键部分.
Because a critican section is only a critical section in the process in which it is defined.


重要部分是特定于线程的:您不需要跨过程边界的关键部分.
Critical sections are thread specific: you don''t need critical section across process boundaries.


因为可以使用Mutex.它们的效率较低,但可以跨过程使用.

另外,由于两个进程的地址空间不同,因此在另一个进程中查找对象需要一个名称,并且关键部分没有命名.
Because Mutex can be used for that. They are less efficiency but can works across process.

Also, since the address space of 2 processes are different, a name is required to find the object in the other process and critical section are not named.


这篇关于多线程:关键部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆