首页 > 试题广场 >

When a signal is performed on

[问答题]
When a signal is performed on a condition inside a monitor,the signaling process can either continue its execution or transfer control to the process that is signaled.How would the solution to the preceding exercise differ with the two different ways in which signaling can be performed?
推荐
The solution to the previous exercise is correct under both situations.However,it could suffer from the problem that a process might be awakened only to find that it is still not possible for it to make forward progress either because there was not sufficient slack to begin with when a process was awakened or if an intervening process gets control,obtains the monitor and starts accessing the file.Also,note that the broadcast operation wakes up all of the waiting processes.If the signal also transfers control and the monitor from the current thread to the target,then one could check whether the target would indeed be able to make forward progress and perform the signal only if it it were possible.Then the “while”loop for the waiting thread could be replaced by “if” condition since it is guaranteed that the condition will be satisfied when the process is woken up.
发表于 2018-05-05 22:16:04 回复(0)