# 练习

## 练习1：比较函数

比较一个在lab5和lab6都有, 但是实现不同的函数, 说说为什么要做这个改动, 不做这个改动会出什么问题。

{% hint style="success" %}
如`kern/schedule/sched.c`里的函数。你也可以找个其他地方做了改动的函数。
{% endhint %}

## 练习2：分析`sched_class`

理解并分析 sched\_class 中各个函数指针的用法，并描述ucore如何通过Round Robin算法来调度**两个进程**，并解释sched\_class里的**每个**函数（函数指针）是怎么被调用的。

## 练习3：二选一

1. 简要说明如何设计实现”多级反馈队列调度算法“，给出概要设计，鼓励给出详细设计
2. 简要证明/说明（不必特别严谨，但应当能够”说服你自己“），为什么Stride算法中，经过足够多的时间片之后，每个进程分配到的时间片数目和优先级成正比。

## 练习4：实现Stride调度算法

在`kern/schedule/default_sched_stride.c`填写`Stride`调度算法实现。

{% hint style="success" %}
你需要调试`proc.c`中的一个bug，才能使调度算法正常运行。
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nankai.gitbook.io/ucore-os-on-risc-v64/lab6/lian-xi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
