Operating Systems System Calls and I/O Page 2


Want the latest storage insights?

Download the authoritative guide: Enterprise Data Storage 2018: Optimizing Your Storage Infrastructure


System Call for Synchronous I/O

The following is a list of common system calls and their meaning:

open -- Opens a file descriptor. Important options for some systems include:

  1. Large files over 2GB
  2. Synchronous I/O for data integrity
  3. Reading/writing
  4. Direct I/O -- I/O which moves directly from user space to the device without using any system caching

lseek -- Sets the file descriptor to the byte position specified.

  1. Some systems require the use of lseek64 for files larger than 2GB

read -- Reads data from a file descriptor into the user data area (buffer)

  1. Allows the application to check for errors

pread -- Reads data from a file descriptor into the user data area (buffer) from a specific location in the file. This is the equivalent of a read and lseek, but it does not set the file pointer to the position as the lseek system call does.


System Call for Asynchronous I/O

POSIX standards for real-time systems document the required support for asynchronous I/O (POSIX 4). The concept of asynchronous I/O was originally developed by the benchmarking group at Control Data Corporation back in the late 1960s. They needed a way to read data from FORTRAN programs (punch cards) while still being able to execute the programs because the disks were far slower than the CPU (not much has changed in 35 years).

The application was based on reading data at the beginning of a time period. By using asynchronous I/O, they were able to have the data available when they were ready to use it in the application. What was implemented was a FORTRAN I/O statement called BUFFER IN/OUT and the associated operating system changes. But enough with the history; today, most operating systems support POSIX asynchronous system calls within the operating system.

aio_read -- Asynchronous read request

a. Allows the application to check for errors.

aio_write -- Asynchronous write request

a. Allows the application to check for errors.

lio_listio -- A special call that allows you to issue a list of reads or writes with a single system call. This is very useful when reading or writing a number of records in a file at the same time. I believe a good friend of mine from Cray Research Larry Schermer originally created the list I/O call in the 1980s during Cray's transition to UNIX.

a. Allows the application to check for errors.

Page 3: How Does It All Work?


Submit a Comment


People are discussing this article with 0 comment(s)