1/27
Vocabulary flashcards covering key terms from Lecture 19-20 on synchronous vs asynchronous I/O, signals, fcntl, POSIX AIO, and diagnostic tools.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Synchronous I/O
Input/Output operations that block program execution until the operation completes, e.g., reading from stdin with scanf or cin.
Asynchronous I/O
I/O operations that allow a program to continue executing while the operation is in progress, enabling non-blocking interaction with users or devices.
stdin (Standard Input)
Default file descriptor 0; a synchronous input stream that blocks when a program waits for user input.
stdout (Standard Output)
Default file descriptor 1; a synchronous output stream that can block if the terminal cannot accept more data.
Blocking
Program execution is halted until an I/O operation finishes; characteristic of synchronous I/O.
Non-blocking
Program execution continues while an I/O request is handled in the background; characteristic of asynchronous I/O.
Level Tracking
Monitoring the state of every possible item in a fixed list, even when few change; potentially expensive in memory and time.
Edge Tracking
Monitoring only when state changes occur, making it efficient for large sets where few elements change, e.g., active web-server connections.
Thread-based I/O Solution
Using separate threads to perform I/O and computation concurrently, synchronized with mutexes, waits, or signals.
SIGIO
A POSIX signal sent to a process when a file descriptor becomes ready for input or output; disabled by default.
fcntl()
System call that manipulates file-descriptor flags and properties: int fcntl(int fd, int cmd, …).
F_SETFL
fcntl command used to set file-descriptor flags such as O_ASYNC.
O_ASYNC
File-descriptor flag that enables delivery of SIGIO signals when the descriptor is ready.
F_SETOWN
fcntl command that designates which process (by PID) receives SIGIO for a given file descriptor.
F_GETFL
fcntl command that retrieves current file-descriptor flags before modification.
File Descriptor (fd)
Integer handle used by the kernel to access files, sockets, or pipes; 0, 1, 2 correspond to stdin, stdout, stderr.
stty raw
Terminal setting that disables line buffering and character echo, giving programs unprocessed input.
stty cooked
Default terminal mode that processes special characters (e.g., backspace, arrow keys) and echoes user input.
POSIX AIO
Library interface providing asynchronous I/O operations (aioread, aiowrite) with configurable notifications.
aiocb
Control block struct used by POSIX AIO to describe an asynchronous I/O request (file descriptor, buffer, size, sigevent, etc.).
aio_read()
POSIX function that queues an asynchronous read request defined by an aiocb structure.
aio_error()
Function that queries the status of a pending asynchronous I/O request, returning 0 on success or an error code.
aio_return()
Function that retrieves the result of a completed asynchronous I/O request, e.g., number of bytes read.
struct sigevent
Structure inside aiocb that specifies how a process is notified when an AIO operation completes (e.g., SIGEV_SIGNAL with SIGIO).
SIGEV_SIGNAL
sigevent notification type indicating completion is reported by sending a specified signal to the process.
Threads vs Signals
Two paradigms for asynchronous I/O: threads create concurrent execution contexts; signals deliver asynchronous notifications within one thread.
strace
Linux tool that intercepts and logs system calls and signals made by a process; invoked with strace ./program (use -f to trace forked children).
-lrt
Linker flag that links the real-time library (librt) containing POSIX AIO functions.