Page 1 of 2

Mailboxes and queues examples?

Posted: Wed Mar 21, 2012 9:47 pm
by kermitas
Hello everybody, hello Giovanni :).

If there are no stupid questions ... I wonder to know where can I find mailboxes and queues usage examples??

Thanks:)
Arthur.

Re: Mailboxes and queues examples?

Posted: Wed Mar 21, 2012 10:01 pm
by Giovanni
Hi Arthur,

You may look into the test code under ./test, you can find there examples for all kernel functions, feel free to ask questions on the forum if you have any doubt. Device drivers are also good examples for Queues, Semaphores and Events.

Consulting documentation while browsing the code is also a good idea. :)

Giovanni

Re: Mailboxes and queues examples?

Posted: Wed Mar 21, 2012 10:02 pm
by Giovanni
Ah, for mailboxes look at the "IRQ_STORM" demos under ./testhal, MBs are used heavily there.

Giovanni

Re: Mailboxes and queues examples?

Posted: Wed Mar 21, 2012 10:04 pm
by utzig
Hi,

The test/ directory in the sources root has examples for most kernel features. In specific you should look to test/testmbox.c and test/testqueues.c.

Fabio Utzig

Re: Mailboxes and queues examples?

Posted: Thu Mar 22, 2012 10:37 am
by kermitas
Thans :).

I didn't know where to start.

I am thinkig about something similar to actors model - like in Scala (www.akka.io) or Erlang:
- each actor has it own mailbox
- actors exchange messages
- actors uses thread pool
- if actor receive message ask thread pool if there is free thread, if yes it uses it to proces all messages from mailbox
- thread pool can have for example: small number of threads in the night and grow during the day to proces users demand
- scheduler can send registered message periodically to actor to "wake it up" and to do some cyclic work; scheduler can also send message once at defined time

I like this separation between actors and threads. You can have many actors and only one-or-two threads.

What you think about it? Do you know actors model? :)

...but to write all of this I have to learn a lot about ChibiOS :)).
Arthur.

Re: Mailboxes and queues examples?

Posted: Thu Mar 22, 2012 11:56 am
by Giovanni
Hi,

Look at that IRQ_STORM demo, there is a single thread in multiple instances, each instance has its own mailbox and all instances send messages each other, very similar to what you described.

It is meant as a stress test.

Giovanni

Re: Mailboxes and queues examples?

Posted: Thu Mar 22, 2012 2:10 pm
by kermitas
Giovanni wrote:Hi,

Look at that IRQ_STORM demo, there is a single thread in multiple instances, each instance has its own mailbox and all instances send messages each other, very similar to what you described.

It is meant as a stress test.

Giovanni


Yes, I am anaylzing IRQ_STORM demo right now.

In case of future questions - should I split them in to many simple-to-answer questions posted here, in "support" forum?

Thanks,
Arthur.

Re: Mailboxes and queues examples?

Posted: Thu Mar 22, 2012 2:15 pm
by Giovanni
Focused questions are more efficiently answered of course.

Giovanni

Re: Mailboxes and queues examples?

Posted: Thu Nov 22, 2018 1:16 am
by sabdulqadir
utzig wrote:Hi,

The test/ directory in the sources root has examples for most kernel features. In specific you should look to test/testmbox.c and test/testqueues.c.

Fabio Utzig


Have the structure changed? Could not find these in the current distribution. Or am i not looking at the correct stuff (https://github.com/ChibiOS/ChibiOS/tree/master/test) ?

Thanks
AQ

Re: Mailboxes and queues examples?

Posted: Thu Nov 22, 2018 8:44 am
by Giovanni
Hi,

It is \test\rt\source\test now.

Giovanni