Monday 8 October 2012

How to Hide I/O Latency/Bandwidth of DISK

How to Hide I/O Latency/Bandwidth of DISK

For Example you are trying to make a real time application and you want to write block by block processed data to a disk.

If you keep waiting for the previous block data to be written in to disk you will miss the deadline of processing next block

How to Hide this latency in the application

           You can use Asynchronous I/O call  but just call to  Asynchronous I/O will take time (not writing just initialisations) My application is sensitive to this delay also

           I do not want to add any I/O related delay to processing
 
           Then solution is create a separate thread for I/O
           Main two buffers one for processed output and one for processing output
           when processed output is ready unlock the thread
           while I/O thread is writing processing thread will continue processing and fill up the next buffer
            When second buffer is ready wait for the first buffer I/O completion (this wait time will be '0' in most of the cases)

          Like this we can make I/O overhead zero for the application

  (this is solution is given assuming sufficient processor cores are available for processing and I/O thread)
  
 

No comments:

Post a Comment