2011-01-26

Big-oh 和 master method

這是今天補習時一直困擾我的兩樣東西

所以乾脆就把東西查查寫寫,以造福後人。

是說如果你不去看英文wiki反而來我這個部落格大概也是走投無路了,那我也就不害羞把有點白癡的想法寫下來了。

補一個還滿詳細的Bog-Oh相關網頁 http://www.cyut.edu.tw/~ckhung/b/al/asympt.php
排版有點不親民不過也只有這個毛病了

2011-01-19

關於矩陣那麼點兒事

用 **array取代array[MAX][MAX]的好處不只有大小可以自己指定

除了降低閱讀性稍微降低這個缺點外

在各個thread中傳遞一個矩陣的指標比傳遞整個陣列本身來的容易

缺點就是邊界限制不夠強…

ex:

在main中使用
int **ary;
ary = malloc((MAX+1)*sizeof(*ary));
for(i=0;i<=MAX;i++)
{ary[i]=malloc((MAX+1)*sizeof(**ary));    }


你在thread的地方就可以直接



void subForThread(int *ary)

if(*(ary+j) > *(ary+j+1))
{
temp =*(ary+j);
*(ary+j)=*(ary+j+1);
*(ary+j+1)=temp;
}



2011-01-17

OS

※ 引述《ch890333 (紅狼)》之銘言:
> Typically, at the completion of a device I/O, a single interrupt is raised
> and appropriately handled by the host processor. In certain settings,96
> however, the code that is to be executed at the completion of the I/O
> can be broken into two separate pieces, one of which executes imme-
> diately after the I/O completes and schedules a second interrupt for
> the remaining piece of code to be executed at a later time. What is the
> purpose of using this strategy in the design of interrupt handlers?


The purpose of this strategy is to ensure that the most critical
aspect of the interrupt handling code is performed first and the less
critical portions of the code is delayed for the future.

這種兩截式策略是為了確保中斷重要的部份可以先被執行,不那麼重要的部份可以稍晚執行。

For instance, when a device finishes an I/O operation, the device control
operations corresponding to declaring the device as no longer being busy are
more important in order to issue future operations.

像是一個裝置完成IO後,會馬上發表相對聲明︰『我很閒!!!』以表明未來可以接受排程。

However, the task of copying the data provided by the device to the
appropriate user or kernel memory regions can be delayed for a future
point when the CPU is idle.


不過,像是把IO動作所copy的內容顯示給使用者或塞進kernel記憶體這些事情就可以讓CPU在未來有空的時候再做。

In such a scenario, a latter lower priority interrupt handler is used to perform the copy operation.

在這種情況下,(比基尼…我是說兩截式通知的)下半截/延遲/沒那麼重要的通知就會被運用在copy操作中。


--
快來人找我去翻譯課本!!