Avoid blocking I/O calls

To preserve concurrency, a well-behaved C UDR must avoid system calls that perform blocking input and output operations (I/O).

The following operating-system calls are examples of calls that can block input and output operations:

  • accept() bind() fopen() getmsg()
  • msgget() open() pause() poll()
  • putmsg() read() select()
  • semop() wait() write()

When a C UDR executes any of these system calls, the CPU VP must wait for the I/O to complete. In the meantime, the CPU VP cannot process any other requests. The database server can appear to stall because the concurrency of the CPU VP is impaired.

If your C UDR needs to perform file I/O, do not use operating-system calls to perform this task. Instead, use the DataBlade® API file-access functions. These file-access functions allow the CPU VP to process the I/O asynchronously. Therefore, they do not block the CPU VP. For more information, see Access to operating-system files.

If your UDR must issue blocking I/O calls, assign the routine to execute in a user-defined VP class. When a UDR blocks a user-defined VP, only those UDRs that are assigned to that VP are affected. You might need to use a single instance of a user-defined VP, which would affect client response. Your UDR must also handle any problems that can occur if the thread yielded; for example, operating-system file descriptors do not migrate with a thread if it moves to a different VP.