[理工] OS幾個問題
[1]After a user program starts an I/O operation, it has to wait for
the completion of the I/O operation to resume its program execution.
此題要選對的 這是其中一個選項 但答案卻沒有選
是否和nonblocking和asynchronous system call有關呢?
[2]有關thread pool
1.想請問當有人要一條thread 且thread pool有一條available的
那當該條thread被要走後 該條thread是還在thread pool中但not available
還是不在thread pool中呢?
我看到恐龍書有句寫Once the thread completes its service, it returns
to the thread pool.所以應該算是不在嗎?
2.Only when a thread finishes and leaves the pool, we can allow new
threads to enter the pool.
答案寫此敘述是對的 沒寫原因
恐龍書寫thread pool的地方也沒看到有關的描述
但根據1.提到恐龍書的描述 當有一個thread finishes
不是應該returns to the thread pool嗎? 為什麼會寫leave呢?
還是是說thread finishes後也有可能把memory還給系統的意思呢?
3.A preemptibe CPU scheduler may choose a thread to leave the thread
pool before the thread finishes.
此敘述是錯的 同樣對leave有疑問 若暫且假設2.的最後一句是對的
此外 這項敘述似乎也代表著1.提到的疑問是thread使用時還在thread pool?
是否把leave the thread pool改成block this thread就正確了呢?
4.In Many-to-Many model, the number of kernel threads can be specific
to either a particular application or a particular machine.
此敘述是對的 但我看不懂它的意思......
[3]Response time
假設Process Pi在t=1時到達 t=3時開始做 t=6時被較高Priority的Process插隊
則Pi的Response time是3-1=2 還是6-1=5 或是都不對呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.67.81
※ 編輯: jack0602 來自: 140.113.67.81 (12/12 21:37)
推
12/12 22:30, , 1F
12/12 22:30, 1F
推
12/13 00:39, , 2F
12/13 00:39, 2F
→
12/13 00:42, , 3F
12/13 00:42, 3F
→
12/13 00:43, , 4F
12/13 00:43, 4F
→
12/13 00:43, , 5F
12/13 00:43, 5F
→
12/13 00:44, , 6F
12/13 00:44, 6F
→
12/13 00:45, , 7F
12/13 00:45, 7F
推
12/13 00:45, , 8F
12/13 00:45, 8F
→
12/13 00:47, , 9F
12/13 00:47, 9F
→
12/13 00:47, , 10F
12/13 00:47, 10F
推
12/13 00:47, , 11F
12/13 00:47, 11F
→
12/13 00:49, , 12F
12/13 00:49, 12F
推
12/13 00:50, , 13F
12/13 00:50, 13F
→
12/13 00:50, , 14F
12/13 00:50, 14F
→
12/13 00:53, , 15F
12/13 00:53, 15F
→
12/13 00:55, , 16F
12/13 00:55, 16F
→
12/13 00:56, , 17F
12/13 00:56, 17F
→
12/13 00:56, , 18F
12/13 00:56, 18F
推
12/13 01:14, , 19F
12/13 01:14, 19F
→
12/13 01:14, , 20F
12/13 01:14, 20F
感謝各位回應!!!
所以當thread pool中可用的thread皆在使用中
也就是沒有available的thread 此時有人request a thread
則會等待(或許放入一個Queue中) 直到有thread終止
然後就會create a new thread給等待的使用
也就是說會維持thread pool中thread的數量是個定值
請問上面這段敘述是否正確呢?
另外關於Response time
process正在被執行且不是在做context switch的時候
也可能因為cache miss而需要把cache block換下去寫回memory不是嗎?
我覺得或許process執行到中途就有response
所以由題目給的資訊或是看Gantt chart等應該不能知道Response time才對
※ 編輯: jack0602 來自: 140.113.67.81 (12/13 16:17)
推
12/13 19:01, , 21F
12/13 19:01, 21F
→
12/13 19:01, , 22F
12/13 19:01, 22F
→
12/13 19:01, , 23F
12/13 19:01, 23F
討論串 (同標題文章)