0

O_WRONLY|O_SYNC|O_DIRECT を使用して、ディスクへの単一ブロック書き込みを使用してハートビートするアプリケーションを作成しました。

このデバイスのバッファ キャッシュを無効にするために必要なことはありますか?

テスト中はリーダーはありません。次のようにシミュレートできます。

# dd of=/dev/sda1 bs=512 count=1 if=/dev/zero oflag=direct,dsync

「iostat 1」によると、書き込むたびに何かがデバイスから読み取られています。

「skip=1000」などを追加しても動作は変わりません
。/dev/sda または /dev/sda1 を使用すると、動作が少し変わります。

sda:

Linux 2.6.32-431.5.1.el6.x86_64 (wiley)  07/31/2014     _x86_64_ (8 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.07    0.01    0.07    0.04    0.00   99.80

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda              86.00       672.00         1.00        672          1

sda1:

sda              83.00       648.00         1.00        648          1
4

1 に答える 1

0

あはは!

raw(8) ここに見られるように:

https://superuser.com/questions/242928/disable-linux-read-and-write-file-cache-on-partition/464382#464382

書きます:

# dd of=/dev/raw/raw1 bs=512 count=1 if=/dev/zero oflag=direct,dsync

iostat:

sda               2.00         0.00         1.00          0          1
于 2014-07-31T14:01:59.523 に答える