Materials for Topic 6: Vectored I/O & Memory-Mapping
Full C Programs
writev_example.c - a C program demonstrating the use of the writev() vectored I/O system call to write 3 lines at once into a file.
readv_example.c - a C program demonstrating the use of the readv() vectored I/O system call to read 3 lines at once from a file.
mmap_example.c - a C program that maps a file into main memory using mmap(), thereby letting the program access it as an array of characters.
Runnable Linux Commands
The command: gcc -Wall -Wextra -O2 -g -o program program.c
compiles the C source code located inside the file program.c. See more details here.
The command: . ./.short_prompt
executes code inside a file named .short_prompt and sources it (applies all the changes to the current session.) See more details here.
The command: . ./.long_prompt
executes code inside a file named .long_prompt and sources it (applies all the changes to the current session.) See more details here.