#include sys/types.h #include unistd.h #include fcntl.h int fcntl(int fildes, int cmd, /* arg */ ...);
#include sys/mman.h void *mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off); int munmap(void *addr, size_t len); int msync(void *addr, size_t len, int flags);
p(sem) or wait operation if (sem != 0) decrement sem by one else wait until sem becomes non-zero
if (queue of waiters non-empty) restart first process in the queue else increment sem by one