28. Review#

28.1. Common Concurrency and Synchronization System Calls#

Function

Reference

Brief Description

pipe()

here

Creates a pipe for bidirectional interprocess communication

mmap()

here

Allocates a page of virtual memory

pthread_mutex_init()

man 3 pthread_mutex_init

Creates a mutex

pthread_mutex_lock()

here

Locks a mutex

pthread_mutex_unlock()

here

Unlocks a mutex

pthread_mutex_destroy()

man 3 pthread_mutex_destroy

Frees resources allocated to a mutex

sched_yield(), sleep()

here

Call scheduler to switch threads

wakeup(), wakeup_all()

here

Moves threads from the wait queue to the ready queue

sem_init()

here

Initialize a semaphore

sem_wait()

here

sem_post()

here

28.2. Review Questions#