Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionBoth sides next revision | ||
alvis:transitions [2015/12/12 22:14] marcin | — (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Steps (transitions) ====== | ||
- | The set of all possible steps for untimed models with $\alpha^0$ system layers contains the following elements: | ||
- | * //exec// -- performs an evaluation and assignment; | ||
- | * //exit// -- terminates an agent or a procedure, | ||
- | * //in// -- performs communication (input side), | ||
- | * //jump// -- jumps to a label, | ||
- | * //loop// -- enters a loop, | ||
- | * //null// -- performs an empty statement, | ||
- | * //out// -- performs communication (output side), | ||
- | * //select// -- enters a select statement, | ||
- | * //start// -- starts an inactive agent. | ||
- | |||
- | ====== Enable steps (active agents) ====== | ||
- | |||
- | **Definition 1.** Assume $\mathbf{A} = (D, B, \alpha^0)$ is an Alvis model with the current state $S$ and $X$ be an active agent. A step $t$ is **enable** in the state $S$ **with respect to** $X$ (denoted as $S-t(X)\to$) iff: | ||
- | * $X$ is in the **running** mode; | ||
- | * the program counter points out step $t$; | ||
- | * $X$ has not called a procedure. | ||
- | |||
- | Sometimes, an extended version of this notation is used: | ||
- | * $S-start(X, | ||
- | * $S-in(X.p)\to S'$, $S-out(X.p)\to S'$, where $X.p$ is the port used for the communication. | ||
- | |||
- | |||
- | |||
- | ===== exec ===== | ||
- | |||
- | If $X$ is an active agent, $S-exec(X)\to S'$, and a parameter $v$ is assigned a value $a$ with the corresponding //exec// statement, then $S'$ is defined as follows: | ||
- | |||
- | ^ ^ $am(X)$ ^ $pc(X)$ ^ $ci(X)$ ^ $pv(X)$ ^ | ||
- | | $nextpc(S(X)) \ne 0$ | $\mathsf{X}$ | $nextpc(S(X))$ | unchanged | updated parameter $v$ | | ||
- | | $nextpc(S(X)) = 0$ | $\mathsf{F}$ | 0 | $[\;]$ | updated parameter $v$ | | ||
- | |||
- | |||
- | ===== exit ===== | ||
- | |||
- | If $X$ is an active agent, $S-exit(X)\to S'$, then //S//' is defined as follows: | ||
- | |||
- | ^ $am(X)$ ^ $pc(X)$ ^ $ci(X)$ ^ $pv(X)$ ^ | ||
- | | $\mathsf{F}$ | 0 | $[\;]$ | unchanged | | ||
- | |||
- | |||
- | ===== jump ===== | ||
- | |||
- | If $X$ is an active agent, $S-jump(X)\to S'$, then $S'$ is defined as follows: | ||
- | |||
- | ^ $am(X)$ ^ $pc(X)$ ^ $ci(X)$ ^ $pv(X)$ ^ | ||
- | | $\mathsf{X}$ | $nextpc(S(X))$ | unchanged | unchanged | | ||
- | |||
- | ===== loop, null, select ===== | ||
- | |||
- | If $X$ is an active agent, $S-t(X)\to S'$, $t \in \{loop, null, select \}$ then $S'$ is defined as follows: | ||
- | |||
- | ^ ^ $am(X)$ ^ $pc(X)$ ^ $ci(X)$ ^ $pv(X)$ ^ | ||
- | | $nextpc(S(X)) \ne 0$ | $\mathsf{X}$ | $nextpc(S(X))$ | unchanged | unchanged | | ||
- | | $nextpc(S(X)) = 0$ | $\mathsf{F}$ | 0 | $[\;]$ | unchanged | | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ===== start ===== | ||
- | |||
- | If $X$ and $Y$ are active agents, $S-start(X, | ||
- | |||
- | |||
- | ^ ^ $am(X)$ ^ $pc(X)$ ^ $ci(X)$ ^ $pv(X)$ ^ | ||
- | | $nextpc(S(X)) \ne 0$ | $\mathsf{X}$ | $nextpc(S(X))$ | unchanged | unchanged | | ||
- | | $nextpc(S(X)) = 0$ | $\mathsf{F}$ | 0 | $[\;]$ | unchanged | | ||
- | |||
- | |||
- | ^ ^ $am(Y)$ ^ $pc(Y)$ ^ $ci(Y)$ ^ $pv(Y)$ ^ | ||
- | | $Y$ in //init// mode | $\mathsf{X}$ | 1 | $[\;]$ | unchanged | | ||
- | | $Y$ not in //init// mode | unchanged | unchanged | unchanged | unchanged | | ||
- | |||
- | |||
- | |||
- | |||
- | ====== Enable steps (passive agents) ====== | ||
- | |||
- | |||
- | |||
- | **Definition 2.** Assume $\mathbf{A} = (D, B, \alpha^0)$ is an Alvis model with the current state $S$, $X$ is an agent (active or passive) and $Y$ is a passive agent. | ||
- | * We say that $X$ is **directly performing input procedure** $Y.q$ via port $X.p$ iff $(X.p, Y.q) \in \mathcal{C}$ and $proc(Y.q, p) \in ci_S(X)$. | ||
- | * We say that $X$ is **directly performing output procedure** $Y.q$ via port $X.p$ iff $(Y.q, X.p) \in \mathcal{C}$ and $proc(Y.q, p) \in ci_S(X)$. | ||
- | * We say that $X$ is **indirectly performing input procedure** $Y.q$ iff exist agents $Y_1, | ||
- | * We say that $X$ is **indirectly performing output procedure** $Y.q$ iff exist agents $Y_1, | ||
- | * For any passive agent $Y$ performing one of its procedures, $context(Y)$ denotes the active agent $X$ that is performing the procedure directly or indirectly. | ||
- | |||
- | **Definition 3.** Assume $\mathbf{A} = (D, B, \alpha^0)$ is an Alvis model with the current state $S$, $X$ is an active agent, $Y$ is a passive agent, $am_S(Y) = \mathsf{T}$ and $context(Y) = X$. A step $t$ is **enable** in the state $S$ **with respect to** $Y$ iff: | ||
- | * $X$ is in the **running** mode; | ||
- | * the program counter of $Y$ points out step $t$; | ||
- | * $Y$ has not called a procedure. | ||
- | |||
- | |||
- | Results of steps performing for passive agents are defined similarly as for active ones. For example, if $X$ is a passive agent, $S-exec(X)\to S' | ||
- | |||
- | ^ $am(X)$ ^ $pc(X)$ ^ $ci(X)$ ^ $pv(X)$ ^ | ||
- | | $\mathsf{T}$ | $nextpc(S(X))$ | unchanged | updated parameter $v$ | | ||
- | |||
- | The **exec** statement cannot be the last one in the corresponding procedure block, so we do not need to consider two cases as previously. | ||
- | |||
- | |||
- | The **exit** statement always finishes the corresponding procedure. It cannot be placed before the procedure **in** or **out** statement used to collect the procedure argument (return result). | ||
- | |||
- | ====== Communication ====== | ||
- | |||
- | |||
- | |||
- | A communication between two active agents can be initialised by any of them. The agent that initialises it, performs the **out** statement to provide some information and waits for the second agent to take it, or performs the **in** statement to express its readiness to collect some information and waits until the second agent provides it. | ||
- | |||
- | A communication with a passive agent is treated as a procedure call. It can be initialised either by an active agent or by a passive one from inside of its procedure. In case of an input procedure (a parameter is sent to the corresponding passive agent), it is called with the **out** statement. After a procedure is started, its performs its statements. It is necessary to put the **in** statement as one of them - the statement is used to collect the parameter, but it is not necessary to put the statement as the first procedure step. | ||
- | |||
- | Similarly, in case of an output procedure, it is called with the **in** statement. It is necessary to put the **out** statement as one of its statements. It is used to provide the result, but it is not necessary to put the statement at the end of the procedure. In any case, a procedure is finished if the **exit** statement has been performed. The **exit** statement can be used only after the **in/out** statement that corresponds to the procedure call. | ||
- | |||
- | **in** | ||
- | |||
- | **1. An active agent initialises a non-blocking communication with another active agent.** | ||
- | |||
- | If $X$ is an active agents, $S-in(X.p)\to S'$, then $S'$ is defined as follows: | ||
- | |||
- | ^ $am(X)$ ^ $pc(X)$ ^ $ci(X)$ ^ $pv(X)$ ^ | ||
- | | $\mathsf{W}$ | unchanged | $in(p)$ entry add to $ci(X)$ | unchanged | | ||
- | |||
- | |||
- | **2. An active agent initialises a blocking communication with another active agent.** | ||
- | |||
- | In such a case the communication fails and the **fail** section is executed next (if defined). | ||
- | |||
- | If $X$ is an active agents, $S-in(X.p)\to S'$, then $S'$ is defined as follows: | ||
- | |||
- | ^ $am(X)$ ^ $pc(X)$ ^ $ci(X)$ ^ $pv(X)$ ^ | ||
- | | $\mathsf{X}$ | $nextpc(S(X))$ | unchanged | unchanged | | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | FIXME | ||
- | |||
- | |||
- | |||
- | |||
- | **1.** If //X// is an active agent, //Y// is a passive agent, // | ||
- | |||
- | ^ // | ||
- | | **X** | unchanged | add // | ||
- | |||
- | |||
- | ^ // | ||
- | | **T** | // | ||
- | |||
- | |||
- | **2.** If //X// and //Y// are passive agents, // | ||
- | |||
- | ^ // | ||
- | | **T** | unchanged | add // | ||
- | |||
- | |||
- | ^ // | ||
- | | **T** | // | ||
- | |||
- | **3.** If //X// and //Y// are active agents, // | ||
- | |||
- | |||
- | ^ ^ // | ||
- | | // | ||
- | | // | ||
- | |||
- | |||
- | ^ ^ // | ||
- | | // | ||
- | | // | ||
- | |||
- | **4.** If //X// is an active agent, // | ||
- | |||
- | ^ // | ||
- | | **W** | unchanged | add // | ||
- | |||
- | In any considered case, if the port //p// is used to collect values of one type only, then the // | ||
- | |||
- | |||
- | **5.** If //X// is a passive agent, //Y// = // | ||
- | |||
- | ^ // | ||
- | | **T** | unchanged | add // | ||
- | |||
- | |||
- | ^ // | ||
- | | **W** | unchanged | unchanged | unchanged | | ||
- | |||
- | **6.** Suppose //X// is a passive agent, //Y// = // | ||
- | |||
- | ^ // | ||
- | | **T** | // | ||
- | |||
- | // | ||
- | |||
- | If the **in** statement is the last procedure statement then the procedure is finished. Thus the new state //S//' for //X// should be defined as follows: | ||
- | |||
- | ^ // | ||
- | | **W** | 0 | list of accessible procedures | updated parameter //v// | | ||
- | |||
- | If agent //Y// = // | ||
- | |||
- | ^ ^ // | ||
- | | // | ||
- | | // | ||
- | |||
- | If agent //Y// = // | ||
- | |||
- | ^ // | ||
- | | **T** | // | ||
- | |||
- | // | ||
- | |||
- | If calling //p// was the last step of the corresponding //Y//' procedure then the procedure is finished and the new state for //Y//' is generated in similar way as for //X//. | ||
- | |||
- | |||
- | However, there may exist another agents that // | ||
- | The term // | ||
- | |||
- | For more details see: Szpyrka M., Matyasik P., Mrówka R., Kotulski L.: //Formal description of Alvis language with α^0 system layer//. Fundamenta Informaticae, | ||
- | |||
- | Besides agents that potentially called one of //X// accessible procedures, there may exist agents that are waiting for accessibility of //X// procedures in order to fulfil their **select** statements guards. Thus, if the set of potentially called procedures is empty, them we consider states of agents that are waiting due to their select guards and the accessibility of //X// procedures in //S//' | ||
- | makes at least one branch of the corresponding **select** statement open. | ||
- | |||
- | For any such active agent //Z// we have: | ||
- | |||
- | ^ // | ||
- | | **X** | // | ||
- | |||
- | |||
- | For any such passive agent //Z// and the active agent //Z//' = // | ||
- | |||
- | ^ // | ||
- | | **T** | // | ||
- | |||
- | ^ // | ||
- | | **X** | unchanged | unchanged | unchanged | | ||
- | |||
- | |||
- | |||
- | |||
- | **out** | ||
- | |||
- | **1.** If //X// is an active agent, //Y// is a passive agent, // | ||
- | |||
- | ^ // | ||
- | | **X** | unchanged | add // | ||
- | |||
- | |||
- | ^ // | ||
- | | **T** | // | ||
- | |||
- | |||
- | **2.** If //X// and //Y// are passive agents, // | ||
- | |||
- | ^ // | ||
- | | **T** | unchanged | add // | ||
- | |||
- | |||
- | ^ // | ||
- | | **T** | // | ||
- | |||
- | **3.** If //X// and //Y// are active agents, // | ||
- | |||
- | |||
- | ^ ^ // | ||
- | | // | ||
- | | // | ||
- | |||
- | |||
- | ^ ^ // | ||
- | | // | ||
- | | // | ||
- | |||
- | **4.** If //X// is an active agent, // | ||
- | |||
- | ^ // | ||
- | | **W** | unchanged | add // | ||
- | |||
- | In any considered case, if the port //p// is used to send values of one type only, then the // | ||
- | |||
- | **5.** If //X// is a passive agent, //Y// = // | ||
- | |||
- | ^ // | ||
- | | **T** | unchanged | add // | ||
- | |||
- | |||
- | ^ // | ||
- | | **W** | unchanged | unchanged | unchanged | | ||
- | |||
- | **6.** Suppose //X// is a passive agent, //Y// = // | ||
- | |||
- | **Example** | ||
- | |||
- | {{: | ||
- | |||
- | < | ||
- | agent X1 { | ||
- | loop { -- 1 | ||
- | out p; -- 2 | ||
- | } | ||
- | } | ||
- | |||
- | agent X2 { | ||
- | proc q1 { | ||
- | in q1; -- 1 | ||
- | out q2 -- 2 | ||
- | } | ||
- | } | ||
- | |||
- | agent X3 { | ||
- | proc r { | ||
- | in r; -- 1 | ||
- | null; -- 2 | ||
- | } | ||
- | } | ||
- | </ | ||
- | |||
- | |||
- | {{: | ||
- | |||
- | |||
- | **[[: |