I/O Interface

Operating Systems — Lecture 09

One megabyte

$ make run
fwrite                 2048 records of 512 bytes  time:      0.3 ms      0.14 us/record
write                  2048 records of 512 bytes  time:      0.8 ms      0.41 us/record
write O_DIRECT         2048 records of 512 bytes  time:     40.8 ms     19.94 us/record
write O_DIRECT|O_SYNC  2048 records of 512 bytes  time:  10511.3 ms   5132.49 us/record

Same bytes, same file, same disk: a factor of 35,000. All four were told “written”. What did each get?

How far did the data get?

The story

Inside, and outside

Two families

The life of a channel

A number of what?

How the two ends meet

What the kernel keeps

Who shares the file pointer

A file, as a process sees it

Seven calls, two numbers

Size is not space

A process talks to the outside through channels.

It holds a number.

The number is an index in its descriptor table.

The entry points to a channel in the kernel, which remembers how it was opened, where it is in the file, and which file it is.