วันพฤหัสบดีที่ 20 มีนาคม พ.ศ. 2551

How to write data to device with non cache (DIRECT I/O).

Last year (2007) when I worked at my 1st comapany. I was assigned to write interface program for read/write to ATA device with non cache memory.

On Linux u can use basic function as read/write for do it. Not like window that u must use writeasync/sync.

But a little tricky is a first step to open device with direct IO mode. you just add flag O_DIRECT and it will work correctly with non cache access.

example;
fd = open(devName, O_RDWR |O_DIRECT|O_RSYNC | O_SYNC );

:)
Cheers.

ไม่มีความคิดเห็น: