On Sun, Jun 03, 2018 at 09:43:32PM +0300, Ran Shalit wrote: > Hello, Hi Ran, > How should printf and write to disk should be handled in rt application ? > > 1. printf - can it be used in rt application ? how ? > > 2. writing to file in disk - should it be done in separate thread with > lower priority ? or doesn't it make any difference in which thread ? So, typical usecase for writing to disk from an RT app would be logging, something most applications need to do at one stage or another. You do *not* want to write to do any blocking calls directly from an RT thread! At least not any calls that may block outside of your control (like locks). Writing to file is typically one such thing, allocating memory another. If you need to write to disk, I *strongly* suggest you implement some sort of asynchronous setup (writing to a ringbuffer, message-passing with pre-allocated buffers, or some other scheme) and let a different thread handle the actual writing. The same goes for memory, do try to allocate all memory that the RT thread(s) will use at the beginning and avoid all calls to malloc during run-time (this is where C++ can be interesting, so be careful!) Good luck! -- Henrik Austad -- To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html