简体   繁体   English

流程之间的资源竞争

[英]Competition among processes for resources

My OS textbook says the following in a chapter discussing concurrency: 我的操作系统教科书在讨论并发性的章节中说了以下内容:

Concurrent processes come into conflict with each other when they are competing for the use of the same resource. 并发进程在争用同一资源时会相互冲突。 In its pure form, we can describe the situation as follows. 以其纯粹的形式,我们可以将情况描述如下。 Two or more processes need to access a resource during the course of their execution. 两个或多个进程在执行过程中需要访问资源。 Each process is unaware of the existence of other processes, and each is to be unaffected by the execution of the other processes. 每个进程都不知道其他进程的存在,并且每个进程都不会受到其他进程的执行的影响。 It follows from this that each process should leave the state of any resource that it uses unaffected. 由此可见,每个进程都应保持其使用的任何资源的状态不受影响。

My question specifically concerns the last sentence: 我的问题特别涉及最后一句话:

It follows from this that each process should leave the state of any resource that it uses unaffected. 由此可见,每个进程都应保持其使用的任何资源的状态不受影响。

This does not make sense to me. 这对我来说没有意义。 If a process is using a resource, then it must necessarily affect the state of that resource. 如果某个进程正在使用资源,那么它一定会影响该资源的状态。 This seems obvious, but it sounds like the sentence is disagrees? 这似乎很明显,但是听起来这句话是不同意的吗?

I would greatly appreciate it if the members of this site could please take the time to clarify this. 如果本站点的成员可以抽出时间澄清这一点,我将不胜感激。

While it is not clear to me in what context this was said, as you mentioned a small portion of the quote. 我不清楚这是在什么背景下说的,就像您提到的一小部分报价一样。 And didn't even bother to mention the book you quoted. 而且甚至都没有提到您引用的书。 However, I can shoot in the dark and assume that what they meant is: A process using resource X should, once done using it, leave it unaffected. 但是,我可以在黑暗中拍摄,并假设它们的意思是:使用资源X的进程一旦使用完它,就应该不受影响。 That is, if processY decides to use logical resource, ie a file , it should not write or change the file as this might affect processZ which needs to use the file with its original data. 也就是说,如果processY决定使用逻辑资源(即file ,则不应写入或更改文件,因为这可能会影响需要使用文件及其原始数据的processZ

When it comes to physical resources, the statement above makes no sense... unless you provide the full quote. 对于物理资源,除非您提供完整的报价,否则以上声明没有任何意义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM