Fish Touchingūüźüūüé£


Jun 21, 2023

# How

It may be best to use a hybrid that polls for a little while and then, if the device is not yet finished, uses interrupts. This two-phased approach may achieve the best of both worlds.

# IO Measuring

# File IO

A file is a sequence of bytes, nothing more and nothing less. Every I/O device, including disks, keyboards, displays, and even networks, is modeled as a file.

# fsync()

When a process calls fsync() for a particular file descriptor, the file system responds by forcing all dirty (i.e., not yet written) data to disk, for the file referred to by the specified file descriptor. The fsync() routine returns once all of these writes are complete.


At first,¬†2>1¬†may look like a good way to redirect¬†stderr¬†to¬†stdout. However, it will actually be interpreted as “redirect¬†stderr¬†to a file named¬†1”.
& indicates that what follows and precedes is a file descriptor, and not a filename. Thus, we use 2>&1. Consider >& to be a redirect merger operator.
&¬†is only interpreted to mean “file descriptor” in the context of redirections. Writing¬†command &2>&¬†is parsed as¬†command &¬†and¬†2>&1, i.e. “run¬†command¬†in the background, then run the command¬†2¬†and redirect its stdout into its stdout”.