タグ

alignmentに関するyassのブックマーク (3)

  • Why buffered writes are sometimes stalled

    Many people think buffered write (write()/pwrite()) is fast because it does not do disk access. But this is not always true. Buffered write sometimes does disk access by itself, or waits for some disk accesses by other threads. Here are three common cases where write() takes longer time (== causing stalls). 1. Read Modify Write Suppose the following logic. Opening aaa.dat without O_DIRECT/O_SYNC,

    Why buffered writes are sometimes stalled
    yass
    yass 2014/03/11
    " 1. write() does disk read when needed. To avoid this issue you need to append a file, not overwrite. Or use OS page aligned writes.   2. write() may be blocked for "stable page writes". To avoid this issue you need to use newer Linux kernel supporting disabling stable page writes. "
  • データ型のアラインメントとは何か,なぜ必要なのか?

    以前このサイトとブログに,何度かアラインメントに関する記事を書きました (サイト内関連ページ参照). そのせいか「アラインメント」で検索して来てくれる人が多いので, 過去の記事に加筆修正してこのページを新たに作成しました. 加筆した点は次のとおりです. アラインメントとメモリアクセス回数の関係をわかりやすくするため, (ほんの少し) 図を導入しました. 「データがアラインされていないとメモリアクセス回数が増える」 と言葉で説明しているサイトは多いのですが, 図で示しているところはまだ見たことありません. アラインされていないアドレスにデータを書き込む場合, 読み出しの場合以上にメモリアクセス回数がかかる可能性があることを追記しました. 以前は「複合データ型 (配列,構造体,共用体) のアラインメント」はほとんど自明のことだと思っていたので軽く流していましたが, 意外なことにこれを解説してい

    yass
    yass 2013/04/27
    "32ビット CPU では普通,この電線は32本あり,CPU はメモリ上のデータを一度に32ビット (=4バイト) 読み書きする / データの先頭アドレスを4の倍数にすることを「4バイト境界にアライン (align:整列,位置合わせ) する」"
  • Aligned vs. unaligned memory access - Alex on Linux

  • 1