POSIX Threads API

pthread_create

int pthread_create(
	pthread_t *thr, 
	pthread_attr_t *attr, 
	void *(*fn)(void *), 
	void *arg
);

pthread_exit

void pthread_exit(void *return_value);

pthread_join

int pthread_join(phtread_t thread, void **return_value);

pthread_yield

void pthread_yield();

Also has lots of support for Synchronization

Kernel Thread vs. User Thread

Functions like pthread_create can be implemented as a function in either:

Approach #1: Add pthread_create as a kernel thread (1:1)

Pasted image 20231207155201.png

Approach #2: Add pthread_create as user thread (n:1)

Pasted image 20231207162927.png

Approach #3: User threads on kernel threads (n:m)

Pasted image 20231207163627.png