Your approach will likely depend on the mode in which you use UML. For example, using UML as a sketch to communicate high-level details about how elements of the system are related will likely look different than using UML as blueprints that need to lay out design and implementation details for future developers or testers. I've also found that UML diagrams don't often stand on their own and are supported by other diagrams, text, tables, and other non-UML diagrams that offer additional details.
That said, either of the diagrams that you present could be useful, depending on the context. However, there may be other things that you could also consider.
One thing to consider is if it is necessary to include both Partition A and Partition B on the same diagram. Perhaps a more detailed diagram showing the process of Partition A that results in data being written to a data store or published on a communication channel and a second detailed diagram showing the process of Partition B that requires reading data could be useful. It seems like both Partition A and Partition B would be doing more than just writing and reading data, so diving into those details and using a textual description of how the RTOS functionality enables exchanging data between components could be helpful.
The broadness of "RTOS" is also interesting. A real-time operating system tends to offer various elements. Regardless of if you take your current approach or the approach I propose above, instead of showing an interaction with "RTOS", showing an interaction with more specifically-named services offered by the RTOS could give additional details about the system design.
If you take the UML as Sketch approach, there's also nothing preventing you from having multiple diagrams. Your second diagram, showing that data flows from Partition A to Partition B may be useful to some stakeholders, but additional diagrams showing more details about Partition A and Partition B in isolation could be useful to other stakeholders. This is essentially combining approaches.
Understanding exactly who will be using this diagram and what they will be using it for can help you determine how to structure it.