Is it possible to implement a real-time API to read the files on the disk?

孙世龙 sunshilong sunshilong369 at
Thu Jan 7 13:12:18 CET 2021

I see. Thank you for your detailed explanation.

My understanding of this question is at a different level with your
generous help.

>You can guarantee _average_ data for I/O to storage devices, like a
>guaranteed sustained throughput (*), but you will not be able to
>guarantee any hard real-time behaviour (like latencies or such).
It seems that real-time OS could not guarantee a hard real-time
behaviour for reading files.

Two more questions arise:
1. A lot of real-time applications based on Xenomai have to meet this
 problem (i.e reading files), how do you solve it?
Reading files by non-rt thread and sending the data(or the pointer to
the data) to the rt thread by XDDP?

2.Can I draw the conclusion that there is no real-time OS that could
guarantee a hard real-time behaviour for reading?

Best regards.

On Thu, Jan 7, 2021 at 7:14 PM Wolfgang Denk <wd at> wrote:
> Dear 孙世龙 sunshilong,
> In message <CAAvDm6bxvLaeRYvTpQM9CgewnK5qRrpV8ExQSuJ72d3axfcYRA at> you wrote:
> > >depends on your use case, maybe possible to add a raw disk, only used by
> > >the time critical code?
> > It seems a good solution.
> > It's possible to add a raw disk.
> This will not help you at all.  The key problem here is that common
> storage devices (conventional rotating hard disk drives, SSD,
> SDCards, eMMC, USB sticks, CF Cards, ....) are all not real-time
> capable itself.
> They all contain controllers to manage the storage device, and
> strict real-time behaviour has never been a design criteria for the
> firmware running on these controllers.
> Rotating harddisks can do all kind of maintainance tasks, including
> retries when they detect positioning and/or I/O errors,
> re-allocation of defective sectores, recalibration, etc. Not to
> mention that - depending on your configuration - they may even spin
> down to save power and will need many seconds to spin up when waking
> up.
> All other storage devices are flash based, so the controller will
> have to take care of wear levelling, trimming, garbage collection
> etc.
> Try to get any guaranteed data for response times from any of the
> vendors of your prefereed sotage data (i. e. ask: what is the
> _guaranteed_ maximum time between sending a read request for a
> specific block of data and receiving this data on the interface?)
> I would not expect any precise technical answers.
> You can guarantee _average_ data for I/O to storage devices, like a
> guaranteed sustained throughput (*), but you will not be able to
> guarantee any hard real-time behaviour (like latencies or such).
> (*) And this guarantee will hold only as long as you do not
> encounter any errors on the storage device, which can _always_
> happen, so your real-time processes should better not depend on it
> if they control any critical equipment.
> Best regards,
> Wolfgang Denk
> --
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at
> As long as we're going to reinvent the wheel again, we might as  well
> try making it round this time.                        - Mike Dennison

More information about the Xenomai mailing list