View topic - Resource Manager with multiple clients

Resource Manager with multiple clients

anything that doesn't fit to other groups.

Resource Manager with multiple clients

Postby flapdoodle » Wed Aug 11, 2010 9:35 am

Hi folks,
I'm creating a resource manager that will have many read clients. A lower level service passes data into the resource manager, which then passes it onto all clients. Clients will be using standard read/open/(maybe select as well).

I've got a basic RM up and running thanks to the docs on QNX's website. However, the example there shows a RM that uses the attribute block to store a list of received data. A read then consumes from this list and removes the last entry and passes it to the client

I'm porting the app from a system that has a framework similar to resource managers, but each client is allocated a "mail box" when it opens the device, and all mailboxes receive a copy of the data from the lower level. Clients then call read and the framework pulls data out of the mailbox.

My current thinking is that I can do this in QNX by using an extended OCB structure that has a per-client list of data (Rather than one per-device) and then a "read" consumes the list for that client.

Another alternative is to implement a per-device list and manage it in such a way that it only discards items when they've been read by all clients, in effect keeping a per-device queue with the latest received always at the head and the rest being those that that haven't been read by all clients. Naturally, there'll be a size limit to a list.

Has anyone created a RM like this before and got any advice (Or am I missing the point of something here...)

Active Member
Posts: 13
Joined: Fri Jul 09, 2010 1:20 pm

RE: Resource Manager with multiple clients

Postby mario » Wed Aug 11, 2010 3:13 pm

The OCB seems like a good approch to me. Your second approch seems to have the advantage of not have multiple copy of the same data but seems a little more complicated to implement.
QNX Master
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Postby PeterHuber » Wed Aug 11, 2010 7:38 pm

Hi flapdoodle,

yes, extending the OCB and managing a read queue for each client is the proper design in my eyes. I propose to implement a reference counting mechanism for the data items instead of duplicating them for each client. But this is only necessary if you expect many clients and big data items.

- Peter
Active Member
Posts: 55
Joined: Sat Sep 01, 2007 11:11 am
Location: Switzerland

Postby flapdoodle » Thu Aug 12, 2010 6:48 pm

Thanks guys. Based on past experience, I suspected this would be the best approach - the data items are small and there won't be large streams of them, so duplicating them in the OCB for each client is not a problem. I could extend it later to add ref counting so they can be shared if there is a requirement to do so.

Is there an API call in the QNX layers to "get all attached OCBs" or will I have to keep my own list in the attribute structure (And add to it whenever there's an open.)
Active Member
Posts: 13
Joined: Fri Jul 09, 2010 1:20 pm

Return to General Programming

Who is online

Users browsing this forum: No registered users and 5 guests