简体   繁体   English

具有依赖性的并行进程

[英]Parallel processes with dependency

There are two parallel processes.有两个并行的过程。 Each process has two steps.每个过程有两个步骤。 The second step of the first process is always executed after the first step.第一个过程的第二步总是在第一步之后执行。 The second step of the second process is performed only under a certain condition.第二过程的第二步仅在特定条件下进行。

Activity diagram:活动图: 在此处输入图像描述

How to reflect an additional condition: to complete the second step of the second process, the first step of the first process must be completed.如何反映一个附加条件:要完成第二个过程的第二步,必须完成第一个过程的第一步。

I managed:我管理: 在此处输入图像描述

Flaws:缺陷:

  1. No match between fork and join fork 和 join 之间不匹配
  2. If the condition of the second process is not met, the token “hangs” before join如果不满足第二个过程的条件,则令牌在加入之前“挂起”

Having looked at your solution once more made me think that you saw issues, where there are none.再次查看您的解决方案后,我认为您看到了问题,但实际上并没有。 You are worried about the hanging token, but that is no issue in this case.您担心挂起的令牌,但在这种情况下这不是问题。 If P22 is bypassed, the token from P11 will go down directly to the join node.如果绕过 P22,来自 P11 的令牌将 go 直接向下发送到加入节点。 P11 and P12 will pass their token down also with no issue, thereby creating that ghost token which gets stuck in the middle right join. P11 和 P12 也将毫无问题地向下传递它们的令牌,从而创建卡在中间右连接中的幽灵令牌。 Since the lower join now has two tokens it will continue to the end where the activity is terminated.由于较低的连接现在有两个令牌,它将继续到活动终止的结尾。 At that point any free running tokens (and even active actions) are terminated as well.届时,任何自由运行的令牌(甚至活动操作)也将终止。 All good.都好。

I leave my former answer for further inspiration.我留下我以前的答案以获得进一步的灵感。 But basically they will all be implemented in similar ways since they represent a gateway.但基本上它们都将以类似的方式实现,因为它们代表一个网关。


Original answer原答案

I guess that using an event would be the best way:我想使用事件是最好的方法:

在此处输入图像描述

This way D can only start (and finish) when the event has been received which is sent after A s completion.这样, D只能在收到A完成后发送的事件时开始(和完成)。

Another way would be to use an object that stores the finalization of action A and which is read by D .另一种方法是使用 object 存储动作A的最终确定并由D读取。

在此处输入图像描述

Note that the diagonal connectors through a ready are ObjectFlow s which UML does not per default distinguish optically (unlike SysML).请注意,通过a ready的对角线连接器是ObjectFlow s,UML 默认情况下不会光学区分(与 SysML 不同)。

P. 374 of UML 2.5 states UML 2.5 的第 374 页指出

Object tokens pass over ObjectFlows, carrying data through an Activity via their values, or carrying no data ( null tokens). Object 令牌通过 ObjectFlow,通过它们的值通过 Activity 携带数据,或者不携带数据(null 令牌)。 A null token can still be passed along an ObjectFlow and used like any other token. null 令牌仍然可以沿 ObjectFlow 传递并像任何其他令牌一样使用。 For example, an Action can output a null token to explicitly indicate that it did not produce an optional value, and a downstream DecisionNode (see sub clause 15.3) can test for this and branch accordingly.例如,一个 Action 可以 output a null 标记来明确指示它没有产生可选值,下游 DecisionNode(参见子条款 15.3)可以对此进行测试并相应地分支。

So you can see that as a buffer holding a token and no real data is needed to be stored.所以你可以看到它是一个持有令牌的缓冲区,不需要存储真正的数据。 Basically that's the same as an event.基本上这与事件相同。 Implementation wise you would use a semaphore or a stream to realize that, but of course at this level you would not care too much about such details.在实现方面,您可以使用信号量或 stream 来实现这一点,但当然在这个级别上您不会太在意这些细节。

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

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