IPC Object | lifetime |
FIFO | process |
Posix mutex | process |
Posix conditional var | process |
Posix read/write lock | process |
fcntl recorder lock | process |
Posix message queue | kernel |
Posix named semaphore | kernel |
Posix memory semaphore | process |
Posix shared memory | kernel |
System V message queue | kernel |
System V semaphore | kernel |
System V shared memory | kernel |
TCP socket | process |
UDP socket | process |
Unix domain socket | process |
明顯的kernel將會隨著有無釋放相關的IPC物件而影響lifetime,另外一個影響因素就是為是否為kernel等級,如果是kernel的lifetim,該物件如果沒有釋放,將會被保留到系統結束為止,換句話說,他會相當的佔用系統的資源
底下是兩大主流Posix與System V所支援的IPC的head file
IPC Object | Header file | functions |
Posix msg queue | mqueue.h | mq_open、mq_close、mq_close、mq_getattr、mq_setattr、mq_send、mq_receive、mq_notify |
Posix semaphore | semaphore.h | sem_open、sem_close、sem_unlink、sem_init、sem_destroy、sem_wait、sem_trywait、sem_post、semgetvalue |
Posix shared memory | sys/mman.h | shm_open、shm_unlink、ftruncate、fstat、mmap、munmap |
System V msg queue | sys/msg.h | msgget、msgctl、msgsnd、msgrcv |
System V semaphore | sys/sem.h | semget、semctl、semop |
System V shared memory | sys/shm.h | shmget、shmctl、shmat、shmdt |
沒有留言:
張貼留言