[CCC DEV] Polling

Christian Jacobsen cljacobsen at gmail.com
Thu Jul 19 16:10:47 BST 2012


Hi,

The program with and without the TRUE -> SKIP should not produce the
same result. If you try the following two programs out you'll see that
the second one exits without error, whereas the first throws an error.

1)
PROC main()
  IF
    FALSE
      SKIP
:

2)
PROC main()
  IF
    FALSE
      SKIP
    TRUE
      SKIP
:

This is because the IF in occam requires that at least one of its
guard expressions to evaluate to TRUE and if not the program stops and
reports an error.


It is true though that with the TRUE -> SKIP the process would never
yield to let other processes run, so you have to something. As an
alternative to the SKIP or the redundant channel communication you
could insert a small delay. This would ensure that other processes are
able to execute while this process is sleeping. Another option is to
insert an explicit reschedule to ensure instruct this process to let
someone else have a go. The TRUE bit of the IF would in these cases
look like one of the following:

TRUE
  delay(some_amount_of_milliseconds)

or

TRUE
  RESCUEDULE()

In the reschedule case this process puts itself on the back of the
run-queue and lets any other process on the queue have a go. If no
other processes are waiting this process will then immediately be
picked off the run queue and executed again.

However, looking at the error code you are reporting "TVM exit code =
0x2912ba4" I don't think this is one of the predefined exit codes
(which I recall are all very small integers, in the two hex digit
range or thereabouts). My guess is that there is perhaps something
wrong with your FFI call which is somehow making the TVM throw an
error.

Regards,
  Christian


On 19 July 2012 16:12, Mathias Spiessens
<mathias.spiessens at student.kuleuven.be> wrote:
> I did try that. However, this has the same result as:
>
>
> PROC sccMesh.recv(CHAN SCCMSG out!)
>   INT coreID, string.length, success:
>   [64]BYTE buffer:
>   WHILE TRUE
>     SEQ
>       coreID := 0
>       c.sccMesh.recv(coreID, string.length, buffer, success) -- wrapper
> process around FFI function
>       IF
>         success > 0
>           out ! coreID; string.length::buffer
> :
>
> Some more information:
>
> The C function (FFI) is called all the time, so this process is executed.
> The other processes are never executed.
>
> Best regards,
>
> Mathias Spiessens
>
>
>
>
> On 19/07/2012 15:55, Martin Ellis wrote:
>>
>> Is there any reason you can't use a SKIP?
>>
>>
>>> PROC sccMesh.recv(CHAN SCCMSG out!)
>>>    INT coreID, string.length, success:
>>>    [64]BYTE buffer:
>>>    WHILE TRUE
>>>      SEQ
>>>        coreID := 0
>>>        c.sccMesh.recv(coreID, string.length, buffer, success) -- wrapper
>>> process around FFI function
>>>        IF
>>>          success > 0
>>>            out ! coreID; string.length::buffer
>>>          TRUE
>>
>>               SKIP
>>>
>>> :
>>
>> --
>> Martin
>
>
>
> _______________________________________________
> developers mailing list
> developers at concurrency.cc
> http://lists.concurrency.cc/mailman/listinfo/developers



More information about the developers mailing list