Libraries
User programs can request services via system calls
- but system calls provide relatively low-level operations
- they require a switch from non-privileged to privileged mode which is expensive.
To simplify programming, libraries are provided:
- collections of useful functions
- referenced from within user programs as C functions
- defined by
#include <xxx.h>
- integrated with user code at "link time"
Examples of libraries:
-
stdio.h ... text-oriented, formatted input/output
-
stdlib.h ... wide range of functions, e.g. rand() , malloc()
- On most linux systems you can find the .h files in
/usr/include
|