~/ learn/ comp-325/ cards/ The UNIX software architecture: API and AUI
1 of 6

A C program calls `printf()`. Which layer does `printf()` belong to, and which interface does that make it part of?

A C program calls `printf()`. Which layer does `printf()` belong to, and which interface does that make it part of?

Answer

The language libraries, and therefore the API

Options - A. The language libraries, and therefore the API - B. The system call interface, and therefore the API - C. The applications layer, and therefore the AUI - D. The kernel, because it eventually writes to the terminal Why - A. Correct — it is C library code running in your process, which then issues a `write` system call underneath. - B. The commonest confusion. `write` is the system call; `printf` is the library wrapper that formats your arguments and then calls it. - C. The AUI is what a person types at a prompt. Nobody types `printf()` at a shell prompt. - D. `printf` causes kernel work but is not kernel code; it runs in user mode in your own address space.

Sarwar & Koretsky 3e ch1 §1.7

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/551b4315-f78b-459d-a4f7-9367103ac9fd/flashcard utf-8 LF