Skip to content

Commit

Permalink
part of the problem solved
Browse files Browse the repository at this point in the history
  • Loading branch information
AstatineAi committed Mar 4, 2024
1 parent 046d76b commit e5314d1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lecture_note/docs/pintos/proj1.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ alarm-negative

相同优先级, 则先进先出.

需要额外记录进入顺序.

### priority-preempt

高优先级线程 `thread_create()` 时可以抢占.
Expand Down Expand Up @@ -201,6 +203,10 @@ TA 拿锁 B, TA 捐赠给 B, B 捐赠给 TB, interrupt
TB 拿锁 A, TB 捐赠给 A, A 捐赠给 TA, TA 捐赠给 B...
```
解决?方式: 对于嵌套优先级捐赠关系的环 (From document "If necessary, you may impose a reasonable limit on depth of nested priority donation, such as 8 levels."), 加一个传递层数即可.
死锁实在没法解决, 可以考虑加一个检查是否所有的线程都被 block, 如果如此就立一个 flag 清除所有的线程, 然后 PANIC.
#### `lock_release()`
`sema_up()`
Expand All @@ -209,6 +215,8 @@ TB 拿锁 A, TB 捐赠给 A, A 捐赠给 TA, TA 捐赠给 B...
问题: 被更新 priority 的 thread 还在堆 / ready_list 里面, 但是插入已经发生了, 该 heap_up / heap_down?
解决?方式: 不管, 下一次进堆的时候就好了.
## Task 3
在全局 `bool` 变量 `thread_mlfqs` 为 `true` 的时候, 启用 Multilevel Feedback Queue Scheduling, 而不是 Task 2 的基于优先级的 Round Robin 调度.

0 comments on commit e5314d1

Please sign in to comment.