25.07.2014 Views

VDM-10 Language Manual

VDM-10 Language Manual

VDM-10 Language Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 6. Expressions<br />

• #active(operation name). The number of operation name operations that are currently<br />

active. Thus: #active(operation name) = #act(operation name) - #fin(operation<br />

name).<br />

• #req(operation name). The number of requests that has been issued for the operation<br />

name operation.<br />

• #waiting(operation name). The number of outstanding requests for the operation<br />

name operation. Thus: #waiting(operation name) = #req(operation name) -<br />

#act(operation name).<br />

For all of these operators, the name list version #history op(op1,. . .,opN) is simply shorthand<br />

for #history op(op1) + · · · +#history op(opN).<br />

Examples: Suppose at a point in the execution of a particular thread, three operations, A, B and<br />

C may be executed. A sequence of requests, activations and completions occur during this<br />

thread. This is shown graphically in figure 6.1.<br />

Figure 6.1: History Expressions<br />

Here we use the notation rA to indicate a request for an execution of operation A, aA indicates<br />

an activation of A, fA indicates completion of an execution of operation A, and likewise for<br />

operations B and C. The respective history expressions have the following values for the<br />

interval [S,T]:<br />

#act(A) = 1 #act(B) = 1 #act(C) = 1 #act(A,B,C) = 3<br />

#fin(A) = 1 #fin(B) = 1 #fin(C) = 0 #fin(A,B,C) = 2<br />

#active(A) = 0 #active(B) = 0 #active(C) = 1 #active(A,B,C) = 1<br />

#req(A) = 2 #req(B) = 1 #req(C) = 3 #req(A,B,C) = 6<br />

#waiting(A) = 1 #waiting(B) = 0 #waiting(C) = 2 #waiting(A,B,C) = 3<br />

6.23 The Time Expression (<strong>VDM</strong>-RT)<br />

Syntax: time expression = ‘time’ ;<br />

Semantics: This is simply an easy way to refer to the current time on a given CPU. The time is<br />

provided as a natural number.<br />

Examples: If for example one would like to log when a certain operation takes place one can<br />

create an operation such as logEnvToSys below.<br />

67

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!