Data Sharing Architecture

I am wondering if someone has any advice about how to share data among tasks in an embedded system. I have several producers of data and several possible consumer of the data. In some cases, one consumer may be consuming different types of data. I am wondering what the best way to share this data with a consumer task. Issue # 1: Should I send different pieces of data through a single message queue owned by the consumer, or should there be separate queues for each type of data? My OS requires that I cannot have variable length mesages in a given queue.

Issue #2: Is it best to have single task that asks as a "router" for all of this data. So, essentially, it would take incoming data from producers, and distribute it to interested consumers. Or, is it better to have each producer deliver their respective data to each consumer on their own?

Any thoughts would be appreciated!

Brad

Reply to
Bradford Cox
Loading thread data ...

On Wed, 17 Sep 2003 16:59:51 -0500, "Bradford Cox" wrote in comp.arch.embedded:

It's hard to say for sure without more information about your OS. If all the tasks in your OS live in a common address space, you can pass pointers to blocks of memory containing the data through queues. All queues contain the same size and type of data, namely a pointer.

It your tasks reside in separate address spaces, it becomes more complex. Some operating systems provide special support for this (a system call copies the data from the sending task address space to the receiving address space), or you might have to allocate a queue of objects large enough to hold the largest data item a particular task will receive.

If you provide more detail on your OS and its message queue features.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Reply to
Jack Klein

Depending on the application and context, there may be several possible solutions. It is the job of the designer, in this case you, to weigh them against each other. It may even be helpful to program all of them to do some research on their advantages and disadvantages. BTW, writing a command queue for variable sized commands is not that hard. Give it a try as warm-up exercise.

Rene

--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
& commercial newsgroups - http://www.talkto.net
Reply to
Rene Tschaggelar

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.