[Barrelfish-users] Questions about IDC: Poll or Interrupt

Tim Harris (RESEARCH) tharris at microsoft.com
Wed Mar 14 22:43:24 CET 2012


Hi Jinghao,

The execution of callbacks is co-operative ¨C as you¡¯ve seen, they will execute when calling into the event_dispatch function.  Without this guarantee it would be very difficult to write correct programs ¨C for instance, if callbacks executed at arbitrary points, then they might see the program¡¯s data structures in an inconsistent state (or risk deadlock if synchronizing with the rest of the application).

You might be interested in looking at the AC programming model

http://research.microsoft.com/en-us/um/people/tharris/papers/2011-oopsla.pdf

For historical reasons, AC is called THC in the source code.  There are some examples in the test directories ¨C thctest and thcidctest.  You will need to modify your program¡¯s Hakefile to build the AC version of the stubs, in addition to the default Flounder ones.  With AC, the IO operations are written in a simple synchronous style.  You can then use the ¡°ASYNC¡± and ¡°DO¡­FINISH¡± language features to provide additional work that can be started while waiting for an IO operation to complete.

--Tim






From: Shi Jinghao (Ê·¾­ºÆ£© [mailto:jhshi at cs.hku.hk]
Sent: 14 March 2012 14:14
To: barrelfish-users at lists.inf.ethz.ch
Subject: [Barrelfish-users] Questions about IDC: Poll or Interrupt

Hi,

I am recently working with IDC in Barrelfish, using the API generated by Flounder. I found that I need
to use a separate polling thread to poll the waitset, so that my call backs can get called.

For example, when sending a message:  dummy__msg_tx(binding, MKCONT(send_cb, NULL), value)

Since the send is asynchronous, I can continue to do other stuff after this call. However, I expect that
my send_cb will be called (*interrupt*) once the send is success, which is not the case:  I must manually poll the
binding's waitset using event_dispatch to get send_cb get called.

I now use a separate polling thread to do all this stuff and it works. But I was wondering:

    - Is it designed as this way? Or I don't actually need to poll, just I don't know how...

    - If this is the way as designed, then why? This seems not that "event-driven", right?

Thanks for your reading and forgive me if I asked a stupid question.

Regards,
Jinghao


-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.inf.ethz.ch/pipermail/barrelfish-users/attachments/20120314/6f506626/attachment-0001.html 


More information about the Barrelfish-users mailing list