diff --git a/lab05_report03/src/scheduler.c b/lab05_report03/src/scheduler.c index 35f8d1a..656fbda 100644 --- a/lab05_report03/src/scheduler.c +++ b/lab05_report03/src/scheduler.c @@ -9,6 +9,8 @@ #include #include #include "job.h" +// TODO, only get 0 of 20 points. +// if you know why,plase create issues. void pid_to_name(int pid, char *ret); void pid_to_name_2(int pid, char *ret); diff --git a/lab06_report04/src/init.h b/lab06_report04/src/init.h index 4c99cd5..66b83c7 100644 --- a/lab06_report04/src/init.h +++ b/lab06_report04/src/init.h @@ -4,7 +4,7 @@ * @Author: nanoseeds * @Date: 2020-04-07 14:54:54 * @LastEditors: nanoseeds - * @LastEditTime: 2020-04-07 20:17:46 + * @LastEditTime: 2020-07-04 17:57:46 */ #include #include @@ -13,6 +13,6 @@ #include #include #include - +// 拿到了50/50. extern sem_t db, rc; extern int readcount; \ No newline at end of file diff --git a/lab08_report05/src/banker.cpp b/lab08_report05/src/banker.cpp index 55a00b4..fa3b376 100644 --- a/lab08_report05/src/banker.cpp +++ b/lab08_report05/src/banker.cpp @@ -21,6 +21,7 @@ * @Date: 2020-04-13 19:19:15 * @LastEditors : nanoseeds */ +// TODO, 只拿到了40分中的20分. #include #include #include diff --git a/lab09_report06/report06.md b/lab09_report06/report06.md index 53b00f7..e148ab1 100644 --- a/lab09_report06/report06.md +++ b/lab09_report06/report06.md @@ -4,7 +4,7 @@ * @Author: nanoseeds * @Date: 2020-04-23 10:26:20 * @LastEditors: nanoseeds - * @LastEditTime: 2020-06-04 22:51:05 + * @LastEditTime: 2020-07-04 17:54:08 * @License: CC-BY-NC-SA_V4_0 or any later version --> 0. @@ -20,7 +20,7 @@ 3. What is the segmentation mechanism and its advantages & disadvantages: 1. 分段机制将内存分成长度不定的段,并将每一段中的虚拟地址空间映射到物理地址空间(每一段中对应的物理地址是连续的). - 2. 分段机制的优点:将地址空间隔离,进程之间不会互相影响;运行时地址较为确定,方便使用. + 2. 分段机制的优点:将地址空间隔离,进程之间不会互相影响;运行时地址较为确定,方便使用;可以方便的与其他用户共享代码和数据. 3. 缺点:由于段的长度不确定,所以会产生碎片. 4. What is the paging mechanism and its advantages & disadvantages: diff --git a/lab09_report06/src/mm.cpp b/lab09_report06/src/mm.cpp index d3c3f6e..be98391 100644 --- a/lab09_report06/src/mm.cpp +++ b/lab09_report06/src/mm.cpp @@ -18,7 +18,7 @@ * 实现了相邻free_block的merge. * 每次打印出的free_block均为排序后的顺序.(BF为size小到大,WF为size大到小,FF为地址低位->高位) * */ - +// 完成了基本功能,60分拿到了50. using std::cout; using std::cin; diff --git a/report_07/report_07.md b/report_07/report_07.md index 6fc44b2..0dcde54 100644 --- a/report_07/report_07.md +++ b/report_07/report_07.md @@ -4,9 +4,10 @@ * @Author: nanoseeds * @Date: 2020-05-10 18:42:40 * @LastEditors: nanoseeds - * @LastEditTime: 2020-06-04 22:51:20 + * @LastEditTime: 2020-07-04 17:48:25 * @License: CC-BY-NC-SA_V4_0 or any later version --> + 1. FIFO FIFO算法,每次先查看是否在内存中,如果在内存中则不变; 若不在内存中,如果队列已满,就踢走队列头部的页面,将页面调入队尾 @@ -31,8 +32,10 @@ FIFO算法,每次先查看是否在内存中,如果在内存中则不变; 直到发现页为0,置换此页.节约了在两个列表之间转换的成本. 但是每次还是需要遍历,需要O(n)的时间复杂度. -1. second-chance算法: +5. second-chance算法: 为了避免FIFO把经常使用的页面踢出的弊端,使用一个检查位, 给经常使用的,检查位为1的页面重新加入列表,给第二次机会.从而提升了效率. 换言之,使用了FIFO模式和LRU模式相结合. -从实现上来看,每次都要遍历需要O(n)的时间复杂度. \ No newline at end of file +从实现上来看,每次都要遍历需要O(n)的时间复杂度. + +PS:由于不知名原因,这个report没有被评分,不知道具体情况. \ No newline at end of file diff --git a/report_07/src/pr.cpp b/report_07/src/pr.cpp index 39d4d0e..53f6156 100644 --- a/report_07/src/pr.cpp +++ b/report_07/src/pr.cpp @@ -80,7 +80,8 @@ static std::unordered_map> umap = { {MIN, MIN_F}, {CLOCK, CLOCK_F}, {SECOND_CHANCE, SECOND_CHANCE_F}}; - +// TODO, this do not get any scores, i do not know why. +// If you know, please create issues. int main() { read_input(); umap[algorithm](); diff --git a/report_08/report_08.md b/report_08/report_08.md index e8a964a..8343e9b 100644 --- a/report_08/report_08.md +++ b/report_08/report_08.md @@ -4,7 +4,7 @@ * @Author: nanoseeds * @Date: 2020-05-19 17:14:20 * @LastEditors: nanoseeds - * @LastEditTime: 2020-05-24 21:25:24 + * @LastEditTime: 2020-07-04 17:41:00 * @License: CC-BY-NC-SA_V4_0 or any later version --> [Toc] @@ -88,4 +88,5 @@ Answer: 2. 总共需要的时间为寻道时间+旋转等待时间,旋转等待时间中,每分钟12000转,平均每秒200转,每转平均5ms.而需要进行的旋转有五次,所以一共30ms.如果将199到0的过程认为消耗寻道时间的话,一共消耗(199-100)+(90-0)+(199-0)=388ms,如果不认为的话,一共小号(199-100)+(90-0) =189ms. 所以如果不认为从最高磁道到最低磁道消耗时间需要计算的话,一共消耗219ms,如果认为需要消耗的话(实际上,这个观点来自Lab10 Disk Scheduling guide的样例,在资料中C-look就计算了这个时间,并且CLook作为C-Scan的改进,很难想象花费的时间比C-Scan还多),一共需要418ms. PS:另一种思路是每转平均需要2.5ms,所以是388+15=403. + fix: 正确答案为403ms. 2. 如果使用SSD,当然要使用FIFO算法,因为SSD的寻道时间几乎可以忽略不计,所以这些优化方式都没有必要进行. \ No newline at end of file diff --git a/report_08/src/disk.cpp b/report_08/src/disk.cpp index e5d99b6..ab8d394 100644 --- a/report_08/src/disk.cpp +++ b/report_08/src/disk.cpp @@ -167,8 +167,12 @@ void LOOK(deque track) { output("LOOK", track, distance); } +// TODO, needed is only C_LOOK algorith. +// BUT i only get 26/40 scores, why? +// IF you know why, please create issue for repo. void C_LOOK(deque track) { // TODO , infact, distance of lowest back to highest is hard to decide to calcaute or not. + // this refer the example.in.txt and example.out.txt. std::sort(std::begin(track), std::end(track), std::greater()); int32_t dis = S + 2 * track.front() - 2 * track.back(); while (track.back() <= S) {