Q:

Make python process writes be scheduled for writeback immediately without being marked dirty

We are building a python framework that captures data from a framegrabber card through a cffi interface.  After some manipulation, we try to write RAW images (numpy arrays using the tofile method) to disk at a rate of around 120 MB/s. We are well aware that are disks are capable of handling this throughput. 
The problem we were experiencing was dropped frames, often entire seconds of data completely missing from the framegrabber output.  What we found was that these framedrops were occurring when our Debian system hit the dirty_background_ratio set in sysctl.  The system was calling the flush background gang that would choke up the framegrabber and cause it to skip frames. 
Not surprisingly, setting the dirty_background_ratio to 0% managed to get rid of the problem entirely (It is worth noting that even small numbers like 1% and 2% still resulted in ~40% frame loss)
So, my question is, is there any way to get this python process to write in such a way that it is immediately scheduled for writeout, bypassing the dirty buffer entirely? 
Thanks

A:

Another option is to get the os file id and call os.fsync on it.  This will schedule it for writeback immediately. 