Alternate updated versions of the excellent diagram at https://transactional.blog/how-to-learn/disk-io
mental-model-719c49df_santized.svg
495 lines 19 kB view raw
1<?xml version="1.0" encoding="UTF-8"?> 2<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="642px" height="492px" viewBox="-0.5 -0.5 642 492"> 3 <style type="text/css"> 4 text { font-family: 'Berkeley Mono'; font-size: 12px; } 5 </style> 6 <defs></defs> 7 <g> 8 <g> 9 <g> 10 <g> 11 <g> 12 <rect x="160" y="0" width="120" height="30" fill="none" stroke="none"></rect> 13 </g> 14 <g> 15 <g transform="translate(-0.5 -0.5)"> 16 <switch> 17 <text x="220" y="19" fill="rgb(0, 0, 0)" text-anchor="middle">Application Memory</text> 18 </switch> 19 </g> 20 </g> 21 </g> 22 <g> 23 <g> 24 <rect x="280" y="0" width="120" height="30" fill="none" stroke="none"></rect> 25 </g> 26 <g> 27 <g transform="translate(-0.5 -0.5)"> 28 <switch> 29 <text x="340" y="19" fill="rgb(0, 0, 0)" text-anchor="middle">Page Cache</text> 30 </switch> 31 </g> 32 </g> 33 </g> 34 <g> 35 <g> 36 <rect x="400" y="0" width="120" height="30" fill="none" stroke="none"></rect> 37 </g> 38 <g> 39 <g transform="translate(-0.5 -0.5)"> 40 <switch> 41 <text x="460" y="19" fill="rgb(0, 0, 0)" text-anchor="middle">Disk Cache</text> 42 </switch> 43 </g> 44 </g> 45 </g> 46 <g> 47 <g> 48 <rect x="520" y="0" width="120" height="30" fill="none" stroke="none"></rect> 49 </g> 50 <g> 51 <g transform="translate(-0.5 -0.5)"> 52 <switch> 53 <text x="580" y="19" fill="rgb(0, 0, 0)" text-anchor="middle">Disk Storage</text> 54 </switch> 55 </g> 56 </g> 57 </g> 58 <g> 59 <g> 60 <rect x="20" y="60" width="100" height="20" fill="none" stroke="none"></rect> 61 </g> 62 <g> 63 <g transform="translate(-0.5 -0.5)"> 64 <switch> 65 <text x="22" y="74" fill="rgb(0, 0, 0)">write()</text> 66 </switch> 67 </g> 68 </g> 69 </g> 70 <g> 71 <g> 72 <rect x="20" y="80" width="100" height="20" fill="none" stroke="none"></rect> 73 </g> 74 <g> 75 <g transform="translate(-0.5 -0.5)"> 76 <switch> 77 <text x="22" y="94" fill="rgb(0, 0, 0)">O_DIRECT</text> 78 </switch> 79 </g> 80 </g> 81 </g> 82 <g> 83 <g> 84 <rect x="20" y="100" width="100" height="20" fill="none" stroke="none"></rect> 85 </g> 86 <g> 87 <g transform="translate(-0.5 -0.5)"> 88 <switch> 89 <text x="22" y="114" fill="rgb(0, 0, 0)">+ O_SYNC</text> 90 </switch> 91 </g> 92 </g> 93 </g> 94 <g> 95 <g> 96 <rect x="20" y="180" width="140" height="20" fill="none" stroke="none"></rect> 97 </g> 98 <g> 99 <g transform="translate(-0.5 -0.5)"> 100 <switch> 101 <text x="22" y="194" fill="rgb(0, 0, 0)">O_DIRECT + O_DSYNC</text> 102 </switch> 103 </g> 104 </g> 105 </g> 106 <g> 107 <g> 108 <rect x="20" y="120" width="100" height="20" fill="none" stroke="none"></rect> 109 </g> 110 <g> 111 <g transform="translate(-0.5 -0.5)"> 112 <switch> 113 <text x="22" y="134" fill="rgb(0, 0, 0)">fsync()</text> 114 </switch> 115 </g> 116 </g> 117 </g> 118 <g> 119 <g> 120 <path d="M 333.63 70 L 223 70" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 121 <path d="M 338.88 70 L 331.88 73.5 L 333.63 70 L 331.88 66.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 122 <ellipse cx="220" cy="70" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 123 </g> 124 </g> 125 <g> 126 <g> 127 <path d="M 280 89.5 L 223 89.98" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 128 <ellipse cx="220" cy="90" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 129 </g> 130 </g> 131 <g> 132 <g> 133 <path d="M 280 90 L 400 90" fill="none" stroke="rgb(0, 0, 0)" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="2 6"></path> 134 </g> 135 </g> 136 <g> 137 <g> 138 <path d="M 453.63 89.55 L 400 90" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 139 <path d="M 458.88 89.51 L 451.91 93.07 L 453.63 89.55 L 451.85 86.07 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 140 </g> 141 </g> 142 <g> 143 <g> 144 <path d="M 280 109.5 L 223 109.98" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 145 <ellipse cx="220" cy="110" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 146 </g> 147 </g> 148 <g> 149 <g> 150 <path d="M 280 110 L 400 110" fill="none" stroke="rgb(0, 0, 0)" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="2 6"></path> 151 </g> 152 </g> 153 <g> 154 <g> 155 <path d="M 573.63 110 L 400 110" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 156 <path d="M 578.88 110 L 571.88 113.5 L 573.63 110 L 571.88 106.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 157 </g> 158 </g> 159 <g> 160 <g> 161 <path d="M 573.63 130 L 343 130" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 162 <path d="M 578.88 130 L 571.88 133.5 L 573.63 130 L 571.88 126.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 163 <ellipse cx="340" cy="130" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 164 </g> 165 </g> 166 <g> 167 <g> 168 <rect x="0" y="160" width="120" height="20" fill="none" stroke="none"></rect> 169 </g> 170 <g> 171 <g transform="translate(-0.5 -0.5)"> 172 <switch> 173 <text x="2" y="174" fill="rgb(0, 0, 0)">Data Integrity</text> 174 </switch> 175 </g> 176 </g> 177 </g> 178 <g> 179 <g> 180 <rect x="0" y="40" width="120" height="20" fill="none" stroke="none"></rect> 181 </g> 182 <g> 183 <g transform="translate(-0.5 -0.5)"> 184 <switch> 185 <text x="2" y="54" fill="rgb(0, 0, 0)">File Integrity</text> 186 </switch> 187 </g> 188 </g> 189 </g> 190 <g> 191 <g> 192 <rect x="20" y="200" width="100" height="20" fill="none" stroke="none"></rect> 193 </g> 194 <g> 195 <g transform="translate(-0.5 -0.5)"> 196 <switch> 197 <text x="22" y="214" fill="rgb(0, 0, 0)">fdatasync()</text> 198 </switch> 199 </g> 200 </g> 201 </g> 202 <g> 203 <g> 204 <path d="M 573.63 210 L 343 210" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 205 <path d="M 578.88 210 L 571.88 213.5 L 573.63 210 L 571.88 206.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 206 <ellipse cx="340" cy="210" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 207 </g> 208 </g> 209 <g> 210 <g> 211 <path d="M 280 189.5 L 223 189.98" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 212 <ellipse cx="220" cy="190" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 213 </g> 214 </g> 215 <g> 216 <g> 217 <path d="M 280 190 L 400 190" fill="none" stroke="rgb(0, 0, 0)" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="2 6"></path> 218 </g> 219 </g> 220 <g> 221 <g> 222 <path d="M 573.63 190 L 400 190" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 223 <path d="M 578.88 190 L 571.88 193.5 L 573.63 190 L 571.88 186.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 224 </g> 225 </g> 226 <g> 227 <g> 228 <rect x="20" y="300" width="130" height="20" fill="none" stroke="none"></rect> 229 </g> 230 <g> 231 <g transform="translate(-0.5 -0.5)"> 232 <switch> 233 <text x="22" y="314" fill="rgb(0, 0, 0)">fsync()</text> 234 </switch> 235 </g> 236 </g> 237 </g> 238 <g> 239 <g> 240 <rect x="0" y="280" width="120" height="20" fill="none" stroke="none"></rect> 241 </g> 242 <g> 243 <g transform="translate(-0.5 -0.5)"> 244 <switch> 245 <text x="2" y="294" fill="rgb(0, 0, 0)">macOS Only</text> 246 </switch> 247 </g> 248 </g> 249 </g> 250 <g> 251 <g> 252 <rect x="20" y="320" width="100" height="20" fill="none" stroke="none"></rect> 253 </g> 254 <g> 255 <g transform="translate(-0.5 -0.5)"> 256 <switch> 257 <text x="22" y="334" fill="rgb(0, 0, 0)">fcntl(F_FULLSYNC)</text> 258 </switch> 259 </g> 260 </g> 261 </g> 262 <g> 263 <g> 264 <rect x="20" y="360" width="150" height="20" fill="none" stroke="none"></rect> 265 </g> 266 <g> 267 <g transform="translate(-0.5 -0.5)"> 268 <switch> 269 <text x="22" y="374" fill="rgb(0, 0, 0)">F_NOCACHE + O_DSYNC</text> 270 </switch> 271 </g> 272 </g> 273 </g> 274 <g> 275 <g> 276 <path d="M 573.63 330 L 343 330" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 277 <path d="M 578.88 330 L 571.88 333.5 L 573.63 330 L 571.88 326.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 278 <ellipse cx="340" cy="330" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 279 </g> 280 </g> 281 <g> 282 <g> 283 <path d="M 280 369.5 L 223 369.98" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 284 <ellipse cx="220" cy="370" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 285 </g> 286 </g> 287 <g> 288 <g> 289 <path d="M 280 370 L 400 370" fill="none" stroke="rgb(0, 0, 0)" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="2 6"></path> 290 </g> 291 </g> 292 <g> 293 <g> 294 <path d="M 453.63 370 L 400 370" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 295 <path d="M 458.88 370 L 451.88 373.5 L 453.63 370 L 451.88 366.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 296 </g> 297 </g> 298 <g> 299 <g> 300 <path d="M 453.63 309.97 L 343 309.51" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 301 <path d="M 458.88 310 L 451.87 313.47 L 453.63 309.97 L 451.9 306.47 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 302 <ellipse cx="340" cy="309.5" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 303 </g> 304 </g> 305 <g> 306 <g> 307 <rect x="20" y="220" width="140" height="20" fill="none" stroke="none"></rect> 308 </g> 309 <g> 310 <g transform="translate(-0.5 -0.5)"> 311 <switch> 312 <text x="22" y="234" fill="rgb(0, 0, 0)">sync_file_range (btrfs,zfs)</text> 313 </switch> 314 </g> 315 </g> 316 </g> 317 <g> 318 <g> 319 <rect x="20" y="240" width="140" height="20" fill="none" stroke="none"></rect> 320 </g> 321 <g> 322 <g transform="translate(-0.5 -0.5)"> 323 <switch> 324 <text x="22" y="254" fill="rgb(0, 0, 0)">sync_file_range (ext4,xfs)</text> 325 </switch> 326 </g> 327 </g> 328 </g> 329 <g> 330 <g> 331 <path d="M 453.63 230 L 343 230" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 332 <path d="M 458.88 230 L 451.88 233.5 L 453.63 230 L 451.88 226.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 333 <ellipse cx="340" cy="230" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 334 </g> 335 </g> 336 <g> 337 <g> 338 <path d="M 573.63 250 L 343 250" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 339 <path d="M 578.88 250 L 571.88 253.5 L 573.63 250 L 571.88 246.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 340 <ellipse cx="340" cy="250" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 341 </g> 342 </g> 343 <g> 344 <g> 345 <rect x="0" y="400" width="120" height="20" fill="none" stroke="none"></rect> 346 </g> 347 <g> 348 <g transform="translate(-0.5 -0.5)"> 349 <switch> 350 <text x="2" y="414" fill="rgb(0, 0, 0)">Windows Only</text> 351 </switch> 352 </g> 353 </g> 354 </g> 355 <g> 356 <g> 357 <rect x="20" y="420" width="130" height="20" fill="none" stroke="none"></rect> 358 </g> 359 <g> 360 <g transform="translate(-0.5 -0.5)"> 361 <switch> 362 <text x="22" y="434" fill="rgb(0, 0, 0)">NO_BUFFERING</text> 363 </switch> 364 </g> 365 </g> 366 </g> 367 <g> 368 <g> 369 <path d="M 280 429.5 L 223 429.98" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 370 <ellipse cx="220" cy="430" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 371 </g> 372 </g> 373 <g> 374 <g> 375 <path d="M 280 430 L 400 430" fill="none" stroke="rgb(0, 0, 0)" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="2 6"></path> 376 </g> 377 </g> 378 <g> 379 <g> 380 <path d="M 453.63 430 L 400 430" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 381 <path d="M 458.88 430 L 451.88 433.5 L 453.63 430 L 451.88 426.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 382 </g> 383 </g> 384 <g> 385 <g> 386 <rect x="20" y="460" width="130" height="20" fill="none" stroke="none"></rect> 387 </g> 388 <g> 389 <g transform="translate(-0.5 -0.5)"> 390 <switch> 391 <text x="22" y="474" fill="rgb(0, 0, 0)">FlushFileBuffers</text> 392 </switch> 393 </g> 394 </g> 395 </g> 396 <g> 397 <g> 398 <path d="M 572.63 470 L 342 470" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 399 <path d="M 577.88 470 L 570.88 473.5 L 572.63 470 L 570.88 466.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 400 <ellipse cx="339" cy="470" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 401 </g> 402 </g> 403 <g> 404 <g> 405 <path d="M 640 30 L 0 30" fill="none" stroke="#cccccc" stroke-miterlimit="10"></path> 406 </g> 407 </g> 408 <g> 409 <g> 410 <path d="M 640 150 L 0 150" fill="none" stroke="#cccccc" stroke-miterlimit="10"></path> 411 </g> 412 </g> 413 <g> 414 <g> 415 <path d="M 640 270 L 0 270" fill="none" stroke="#cccccc" stroke-miterlimit="10"></path> 416 </g> 417 </g> 418 <g> 419 <g> 420 <path d="M 640 390 L 0 390" fill="none" stroke="#cccccc" stroke-miterlimit="10"></path> 421 </g> 422 </g> 423 <g> 424 <g> 425 <path d="M 640 490 L 0 490" fill="none" stroke="#cccccc" stroke-miterlimit="10"></path> 426 </g> 427 </g> 428 <g> 429 <g> 430 <rect x="20" y="340" width="140" height="20" fill="none" stroke="none"></rect> 431 </g> 432 <g> 433 <g transform="translate(-0.5 -0.5)"> 434 <switch> 435 <text x="22" y="354" fill="rgb(0, 0, 0)">F_NOCACHE + O_SYNC</text> 436 </switch> 437 </g> 438 </g> 439 </g> 440 <g> 441 <g> 442 <path d="M 280 349.5 L 223 349.98" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 443 <ellipse cx="220" cy="350" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 444 </g> 445 </g> 446 <g> 447 <g> 448 <path d="M 280 350 L 400 350" fill="none" stroke="rgb(0, 0, 0)" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="2 6"></path> 449 </g> 450 </g> 451 <g> 452 <g> 453 <path d="M 453.63 350 L 400 350" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 454 <path d="M 458.88 350 L 451.88 353.5 L 453.63 350 L 451.88 346.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 455 </g> 456 </g> 457 <g> 458 <g> 459 <rect x="20" y="440" width="130" height="20" fill="none" stroke="none"></rect> 460 </g> 461 <g> 462 <g transform="translate(-0.5 -0.5)"> 463 <switch> 464 <text x="22" y="454" fill="rgb(0, 0, 0)">+ WRITE_THROUGH</text> 465 </switch> 466 </g> 467 </g> 468 </g> 469 <g> 470 <g> 471 <path d="M 280 449.5 L 223 449.98" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 472 <ellipse cx="220" cy="450" rx="3" ry="3" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)"></ellipse> 473 </g> 474 </g> 475 <g> 476 <g> 477 <path d="M 280 450 L 400 450" fill="none" stroke="rgb(0, 0, 0)" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="2 6"></path> 478 </g> 479 </g> 480 <g> 481 <g> 482 <path d="M 573.63 450 L 400 450" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 483 <path d="M 578.88 450 L 571.88 453.5 L 573.63 450 L 571.88 446.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10"></path> 484 </g> 485 </g> 486 </g> 487 </g> 488 </g> 489 <switch> 490 <g></g> 491 <a transform="translate(0,-5)" xlink:href="https://www.drawio.com/doc/faq/svg-export-text-problems"> 492 <text text-anchor="middle" font-size="10px" x="50%" y="100%">Text is not SVG - cannot display</text> 493 </a> 494 </switch> 495</svg>