Skip to content

Commit ad3a8fd

Browse files
committed
update grades and todos.
Signed-off-by: Certseeds <51754303+Certseeds@users.noreply.github.com>
1 parent 45fcb4c commit ad3a8fd

File tree

9 files changed

+22
-10
lines changed

9 files changed

+22
-10
lines changed

lab05_report03/src/scheduler.c

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <fcntl.h>
1010
#include <time.h>
1111
#include "job.h"
12+
// TODO, only get 0 of 20 points.
13+
// if you know why,plase create issues.
1214
void pid_to_name(int pid, char *ret);
1315
void pid_to_name_2(int pid, char *ret);
1416

lab06_report04/src/init.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @Author: nanoseeds
55
* @Date: 2020-04-07 14:54:54
66
* @LastEditors: nanoseeds
7-
* @LastEditTime: 2020-04-07 20:17:46
7+
* @LastEditTime: 2020-07-04 17:57:46
88
*/
99
#include <fcntl.h>
1010
#include <pthread.h>
@@ -13,6 +13,6 @@
1313
#include <stdlib.h>
1414
#include <sys/stat.h>
1515
#include <unistd.h>
16-
16+
// 拿到了50/50.
1717
extern sem_t db, rc;
1818
extern int readcount;

lab08_report05/src/banker.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* @Date: 2020-04-13 19:19:15
2222
* @LastEditors : nanoseeds
2323
*/
24+
// TODO, 只拿到了40分中的20分.
2425
#include <iostream>
2526
#include <string>
2627
#include <vector>

lab09_report06/report06.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @Author: nanoseeds
55
* @Date: 2020-04-23 10:26:20
66
* @LastEditors: nanoseeds
7-
* @LastEditTime: 2020-06-04 22:51:05
7+
* @LastEditTime: 2020-07-04 17:54:08
88
* @License: CC-BY-NC-SA_V4_0 or any later version
99
-->
1010
0.
@@ -20,7 +20,7 @@
2020

2121
3. What is the segmentation mechanism and its advantages & disadvantages:
2222
1. 分段机制将内存分成长度不定的段,并将每一段中的虚拟地址空间映射到物理地址空间(每一段中对应的物理地址是连续的).
23-
2. 分段机制的优点:将地址空间隔离,进程之间不会互相影响;运行时地址较为确定,方便使用.
23+
2. 分段机制的优点:将地址空间隔离,进程之间不会互相影响;运行时地址较为确定,方便使用;可以方便的与其他用户共享代码和数据.
2424
3. 缺点:由于段的长度不确定,所以会产生碎片.
2525

2626
4. What is the paging mechanism and its advantages & disadvantages:

lab09_report06/src/mm.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* 实现了相邻free_block的merge.
1919
* 每次打印出的free_block均为排序后的顺序.(BF为size小到大,WF为size大到小,FF为地址低位->高位)
2020
* */
21-
21+
// 完成了基本功能,60分拿到了50.
2222

2323
using std::cout;
2424
using std::cin;

report_07/report_07.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
* @Author: nanoseeds
55
* @Date: 2020-05-10 18:42:40
66
* @LastEditors: nanoseeds
7-
* @LastEditTime: 2020-06-04 22:51:20
7+
* @LastEditTime: 2020-07-04 17:48:25
88
* @License: CC-BY-NC-SA_V4_0 or any later version
99
-->
10+
1011
1. FIFO
1112
FIFO算法,每次先查看是否在内存中,如果在内存中则不变;
1213
若不在内存中,如果队列已满,就踢走队列头部的页面,将页面调入队尾
@@ -31,8 +32,10 @@ FIFO算法,每次先查看是否在内存中,如果在内存中则不变;
3132
直到发现页为0,置换此页.节约了在两个列表之间转换的成本.
3233
但是每次还是需要遍历,需要O(n)的时间复杂度.
3334

34-
1. second-chance算法:
35+
5. second-chance算法:
3536
为了避免FIFO把经常使用的页面踢出的弊端,使用一个检查位,
3637
给经常使用的,检查位为1的页面重新加入列表,给第二次机会.从而提升了效率.
3738
换言之,使用了FIFO模式和LRU模式相结合.
38-
从实现上来看,每次都要遍历需要O(n)的时间复杂度.
39+
从实现上来看,每次都要遍历需要O(n)的时间复杂度.
40+
41+
PS:由于不知名原因,这个report没有被评分,不知道具体情况.

report_07/src/pr.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ static std::unordered_map<Algorithm, std::function<void()>> umap = {
8080
{MIN, MIN_F},
8181
{CLOCK, CLOCK_F},
8282
{SECOND_CHANCE, SECOND_CHANCE_F}};
83-
83+
// TODO, this do not get any scores, i do not know why.
84+
// If you know, please create issues.
8485
int main() {
8586
read_input();
8687
umap[algorithm]();

report_08/report_08.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @Author: nanoseeds
55
* @Date: 2020-05-19 17:14:20
66
* @LastEditors: nanoseeds
7-
* @LastEditTime: 2020-05-24 21:25:24
7+
* @LastEditTime: 2020-07-04 17:41:00
88
* @License: CC-BY-NC-SA_V4_0 or any later version
99
-->
1010
[Toc]
@@ -88,4 +88,5 @@ Answer:
8888
2. 总共需要的时间为寻道时间+旋转等待时间,旋转等待时间中,每分钟12000转,平均每秒200转,每转平均5ms.而需要进行的旋转有五次,所以一共30ms.如果将199到0的过程认为消耗寻道时间的话,一共消耗(199-100)+(90-0)+(199-0)=388ms,如果不认为的话,一共小号(199-100)+(90-0) =189ms.
8989
所以如果不认为从最高磁道到最低磁道消耗时间需要计算的话,一共消耗219ms,如果认为需要消耗的话(实际上,这个观点来自Lab10 Disk Scheduling guide的样例,在资料中C-look就计算了这个时间,并且CLook作为C-Scan的改进,很难想象花费的时间比C-Scan还多),一共需要418ms.
9090
PS:另一种思路是每转平均需要2.5ms,所以是388+15=403.
91+
fix: 正确答案为403ms.
9192
2. 如果使用SSD,当然要使用FIFO算法,因为SSD的寻道时间几乎可以忽略不计,所以这些优化方式都没有必要进行.

report_08/src/disk.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,12 @@ void LOOK(deque<int32_t> track) {
167167
output("LOOK", track, distance);
168168
}
169169

170+
// TODO, needed is only C_LOOK algorith.
171+
// BUT i only get 26/40 scores, why?
172+
// IF you know why, please create issue for repo.
170173
void C_LOOK(deque<int32_t> track) {
171174
// TODO , infact, distance of lowest back to highest is hard to decide to calcaute or not.
175+
// this refer the example.in.txt and example.out.txt.
172176
std::sort(std::begin(track), std::end(track), std::greater<int32_t>());
173177
int32_t dis = S + 2 * track.front() - 2 * track.back();
174178
while (track.back() <= S) {

0 commit comments

Comments
 (0)