Definition:
Process:
get_pid()
- Get process id of the current process
pid_t fork(void)
- Create a new child process and return process id
- The child process will continue to execute the same code as the parent
void exit(int __status)
- Terminate execution with status
void abort()
kill()
Shared memory
key_t ftok(const char *path, int id)
- Generate an interprocess communication (IPC) key
- returns a key based on path and id that is usable in subsequent calls to msgget(), semget(), and shmget()
int shmget(key_t __key, size_t __size, int __shmflg)
- SHared Memory GET
- Creates or retrieves a shared memory segment with the given key, size, and permissions.
void *shmat(int __shmid, const void *__shmaddr, int __shmflg)
- SHared Memory ATtach
- Attach shared memory segment to current process’s address space
int shmdt(const void *__shmaddr)
- SHared Memory DeTach
- Detach shared memory segment from current process’s address space
int shmctl(int __shmid, int __cmd, struct shmid_ds *__buf)
- SHared Memory ConTroL
- Control the shared memory, eg: remove it
Thread
int pthread_create(pthread_t *__restrict__ __newthread, const pthread_attr_t *__restrict__ __attr, void *(*__start_routine)(void *), void *__restrict__ __arg)
- Create a new thread, starting with execution of START-ROUTINE getting passed ARG
- Creation attributed come from ATTR.
- The new handle is stored in *NEWTHREAD.
int pthread_join(pthread_t __th, void **__thread_return)
- Make calling thread wait for termination of the thread
th
- The exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN is not NULL
int pthread_mutex_init(pthread_mutex_t *__mutex, const pthread_mutexattr_t *__mutexattr)
- Initialize a mutex.
- A Mutex Lock (
pthread_mutex_t mutex
)
int pthread_mutex_destroy(pthread_mutex_t *__mutex)
int pthread_mutex_lock(pthread_mutex_t *__mutex)
- Lock a mutex for the current thread
int pthread_mutex_unlock(pthread_mutex_t *__mutex)