int semget(key_t key, int nsems, int semflg); 功能:创建信号量或获取信号量 nsems:信号量的数量 semflg: IPC_CREAT|IPC_EXEC| int semop(int semid, struct sembuf *sops, unsigned nsops); 功能:对信号量增加或减少 struct sembuf { unsigned short sem_num;信号量的编号 short sem_op; 对信号量的操作 short se…