g9414002.p...@gmail.com
unread,Jul 17, 2008, 4:53:18 PM7/17/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 程式之美技術論壇
看完了第一個CPU 50% usage程式,
心底有個想法:
while (true) {
for (i=0; i<9600000; i++) { //此行控制程式執行一秒
//在此要填入主要的工作, 譬如從1加到某個數字求總和
}
Sleep(10); //此行控制程式睡一秒
}
這程式架構不錯, 可以規範程式自己適當地使用一部份的計算資源.
不過, 主要工作要被劃分為許多小階段,
而每當程式執行一秒, 要做完主要工作的多少個部份呢?
主要工作的程式應該不好寫吧...