42 Project Aux tests and definitions
- Data Races: Occur when multiple tasks or threads access a shared resource without sufficient protections
- Mutex: MUTual EXclusion - Protect the execution again other threads running at the same time.
- Semaphore: Some kind of mutex, but with counter
function | Description |
---|---|
memset |
ToDo |
printf |
ToDo |
malloc |
ToDo |
free |
ToDo |
write |
ToDo |
usleep |
ToDo |
gettimeofday |
sys/time.h - get / set time |
pthread_create |
pthread.h - Thread creation |
pthread_detach |
pthread.h - When a detached thread terminates, its resources are automatically released back to the system |
pthread_join |
pthread.h - function waits for the thread specified by thread to terminate |
pthread_mutex_init |
pthread.h - destroy and initialize a mutex |
pthread_mutex_destroy |
pthread.h - destroy and initialize a mutex |
pthread_mutex_lock |
pthread.h - lock and unlock a mutex |
pthread_mutex_unlock |
pthread.h - lock and unlock a mutex |
#Generate code in machine language
$ gcc -S main.c
$ ./philo 5 86400000 3600000 28800000 2
- Valgrind with race condition