Mailboxes and queues examples?

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess

kermitas
Posts: 17
Joined: Wed Mar 21, 2012 9:39 pm

Mailboxes and queues examples?

Postby kermitas » Wed Mar 21, 2012 9:47 pm

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.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Mailboxes and queues examples?

Postby Giovanni » Wed Mar 21, 2012 10:01 pm

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

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Mailboxes and queues examples?

Postby Giovanni » Wed Mar 21, 2012 10:02 pm

Ah, for mailboxes look at the "IRQ_STORM" demos under ./testhal, MBs are used heavily there.

Giovanni

utzig
Posts: 359
Joined: Sat Jan 07, 2012 6:22 pm
Location: Brazil
Has thanked: 1 time
Been thanked: 20 times
Contact:

Re: Mailboxes and queues examples?

Postby utzig » Wed Mar 21, 2012 10:04 pm

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

kermitas
Posts: 17
Joined: Wed Mar 21, 2012 9:39 pm

Re: Mailboxes and queues examples?

Postby kermitas » Thu Mar 22, 2012 10:37 am

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.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Mailboxes and queues examples?

Postby Giovanni » Thu Mar 22, 2012 11:56 am

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

kermitas
Posts: 17
Joined: Wed Mar 21, 2012 9:39 pm

Re: Mailboxes and queues examples?

Postby kermitas » Thu Mar 22, 2012 2:10 pm

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.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Mailboxes and queues examples?

Postby Giovanni » Thu Mar 22, 2012 2:15 pm

Focused questions are more efficiently answered of course.

Giovanni

User avatar
sabdulqadir
Posts: 49
Joined: Fri Mar 23, 2018 7:29 pm
Has thanked: 13 times
Been thanked: 4 times

Re: Mailboxes and queues examples?

Postby sabdulqadir » Thu Nov 22, 2018 1:16 am

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

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Mailboxes and queues examples?

Postby Giovanni » Thu Nov 22, 2018 8:44 am

Hi,

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

Giovanni


Return to “General Support”

Who is online

Users browsing this forum: No registered users and 14 guests