freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

linux環(huán)境進(jìn)程間通信(三):消息隊列-在線瀏覽

2025-02-25 07:54本頁面
  

【正文】 qbytes //注意這里設(shè)置的值大于缺省值 reval=msgctl(msgid,IPC_SET,amp。 if(reval==1) { printf(msg set info error\n)。 } msg_stat(msgid,msg_ginfo)。//刪除消息隊列 if(reval==1) { printf(unlink msg queue error\n)。 } } void msg_stat(int msgid,struct msqid_ds msg_info) { int reval。//只是為了后面輸出時間的方便 reval=msgctl(msgid,IPC_STAT,amp。 if(reval==1) { printf(get msg info error\n)。 } printf(\n)。 printf(number of messages in queue is %d\n,)。 //每個消息隊列的容量(字節(jié)數(shù))都有限制 MSGMNB,值的大小因系統(tǒng)而異。 printf(pid of last msgrcv is %d\n,)。()))。()))。()))。 printf(msg gid is %d\n,)。 小結(jié): 消息隊列與管道以及有名管道相 比,具有更大的靈活性,首先,它提供有格式字節(jié)流,有利于減少開發(fā)人員的工作量;其次,消息具有類型,在實際應(yīng)用中,可作為優(yōu)先級使用。同樣,消息隊列可以在幾個進(jìn)程間復(fù)用,而不管這幾個進(jìn)程是否具有親緣關(guān)系,這一點(diǎn)與有名管道很相似;但消息隊列是隨內(nèi)核持續(xù)的,與有名管道(隨進(jìn)程持續(xù))相比,生命力更強(qiáng),應(yīng)用空間更大。如管道 和有名管道; 2. 隨內(nèi)核持續(xù): IPC一直持續(xù)到內(nèi)核重新自舉或者顯示刪除該對象為止。 附錄 2: 結(jié)構(gòu) msg_queue用來描述消息隊列頭,存在于系統(tǒng)空間: struct msg_queue { struct kern_ipc_perm q_perm。 /* last msgsnd time */ time_t q_rtime。 /* last change time */ unsigned long q_cbytes。 /* number of messages in queue */ unsigned long q_qbytes。 /* pid of last msgsnd */ pid_t q_lrpid。 struct list_head q_receivers。 }。 struct msg *msg_first。 /* last message in queue,unused */ __kernel_time_t msg_stime。 /* last msgrcv time */ __kernel_time_t msg_ctime。 /* Reuse junk fields for 32 bit */ unsigned long msg_lqbytes。 /* current number of bytes on queue */ unsigned short msg_qnum。 /* max number of bytes on queue */ __kernel_ipc_pid_t msg_lspid。 /* last receive pid */ }。 附錄 3: 消息隊列實例輸出結(jié)果: current number of bytes on queue is 0 number of messages in queue is 0 max number of bytes on queue is 16384 pid of last msgsnd is 0 pid of last msgrcv is 0 last msgsnd time is Thu Jan 1 08:00:00 1970 last msgrcv time is Thu Jan 1 08:00:00 1970 last change time is Sun Dec 29 18:28:20 2022 msg uid is 0 msg gid is 0 //上面剛剛創(chuàng)建一個新消息隊列時的輸出 current number of bytes on queue is 1 number of messages in queue is 1 max number of bytes on queue is 16384 pid of last msgsnd is 2510 pid of last msgrcv is 0 last msgsnd time is Sun Dec 29 18:28:21 2022 last msgrcv time is Thu Jan 1 08:00:00 1970 last change time is Sun Dec 29 18:28:20 2022 msg uid is 0 msg gid is 0 read from msg queue 1 bytes //實際讀出的字節(jié)數(shù) current number of bytes on queue is 0 number of messages in queue is 0 max number of bytes on queue is 16384 //每個消息隊列最大容量(字節(jié)數(shù)) pid of last msgsnd is 2510 pid of last msgrcv is 2510 last msgsnd time is Sun Dec 29 18:28:21 2022 last msgrcv time is Sun Dec 29 18:28:22 2022 last change time is Sun Dec 29 18:28:20 2022 msg uid is 0 msg gid is 0 current number of bytes on queue is 0 number of messages in queue is 0 max number of bytes on queue is 16388 //可看出超級用戶可修改消息隊列最大容量 pid of last msgsnd is 2510 pid of last msgrcv is 2510 //對操作消息隊列進(jìn)程的跟蹤 last msgsnd time is Sun Dec 29 18:28:21 2022 last msgrcv time is Sun Dec 29 18:28:22 2022 last change time is Sun Dec 29 18:28:23 2022 //msgctl()調(diào)用對 msg_ctime有影響 msg uid is 8 msg gid is 8 參考文獻(xiàn): ? UNIX網(wǎng)絡(luò)編程第二卷 :進(jìn)程間通信,作者: Stevens,譯者:楊繼張,清華大學(xué)出版社。 ? linux內(nèi)核源代碼情景分析(上),毛德操、胡希明著,浙江大學(xué)出版社,給出了系統(tǒng) V消息隊列相關(guān)的源代碼分析。 ? msgget、 msgsnd、 msgrcv、 msgctl手冊 g an employment tribunal claim Employment tribunals sort out disagreements between employers and employees. You may need to make a claim to an employment tribunal if: ? you don39。t appealed against the disciplinary action your employer has taken against you. However, if you win your case, the tribunal may reduce any pensation awarded to you as a result of your failure to appeal. Remember that in most cases you must make an application to an employment tribunal within three months of the date when the event you are plaining about happened. If your application is received after this time limit, the tribunal will not usually accept it. If you are worried about how the time limits apply to you, take advice from one of the anisations listed under Further hel
點(diǎn)擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1