Blocking write in DataWriter

2 posts / 0 new
Last post
Juanjo Martin's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 07/23/2012
Posts: 48
Blocking write in DataWriter

Hello RTI users,

 

I've got some questions about DataWriters:

 

  1. Does Blocking Write during transmission involves a context switching? (RTI_Connext_UsersManual, 6.3.8.1)
  2. I need the current ocupation percentage of the DataWriter's send window, so Im using DDS_ReliableWriterCacheChangedStatus.unacknowledged_sample_count as the current number of samples in the window and DDS_DataWriterProtocolStatus.send_window_size as the current window size. Am I in the correct way or I'm wrong?
I will be grateful for any help you can provide,
Juan J. Martin.
Organization:
Gerardo Pardo's picture
Offline
Last seen: 3 weeks 14 hours ago
Joined: 06/02/2010
Posts: 589

 

Hi,

 

1) Yes, if the write operation blocks under the circumstances described in the manual and in the on-line doc (see http://community.rti.com/rti-doc/45f/ndds.4.5f/doc/html/api_cpp/classFooDataWriter.html) then the thread that called DataWriter::write()  will be blocked on a binary semaphore and there will be a context switch to another thread and a context switch back to it when the reason for the blocking goes away (or the timeout arrives) and the binary semaphore is signalled.

 

2) Yes, at any point in time the DataWriter has a 'send_window' that defines the maximum number of samples unacknowledged by one or more active reliable readers. The size of this window can change dynamically between the limits imposed by the DataWriterProtocolQosPolicy (http://community.rti.com/rti-doc/45f/ndds.4.5f/doc/html/api_cpp/structDDS__DataWriterProtocolQosPolicy.html).  See the attributes: DataWriterProtocolQosPolicy.rtps_reliable_writer.min_send_window_size and DataWriterProtocolQosPolicy.rtps_reliable_writer.max_send_window_size

The current value of the 'send_window' is indeed accessible as the DDS_DataWriterProtocolStatus.send_window_size

 

Yes, the current number of number of unacknowledged samples by one or more active reliable readers is indeed accessible as the DDS_ReliableWriterCacheChangedStatus.unacknowledged_sample_count  so the percentage of occupation of the send window is:  

DDS_ReliableWriterCacheChangedStatus.unacknowledged_sample_count/DDS_DataWriterProtocolStatus.send_window_size

 

Note however that there is an internal algorithm that is adjusting the send_window_size  based on a measurement of network congestion. See the documentation for send_window_update_period , send_window_increase_factor, and similar fields under http://community.rti.com/rti-doc/45f/ndds.4.5f/doc/html/api_cpp/structDDS__RtpsReliableWriterProtocol__t.html  so if what you are trying to do is adjust the send rate based on the percentage of occupation you need to think about how this would interact with this algorithm... 

 

Regards,

Gerardo