We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ROS/ros.c
Line 139 in 048799c
else { // remove terminated task do { new_tcb = ros_tcb_dequeue(current_tcb->priority); } while (new_tcb && new_tcb->status == TASK_TERMINATED); if (new_tcb) { ros_tcb_enqueue(current_tcb); ros_switch_context_shell(current_tcb, new_tcb); }
The text was updated successfully, but these errors were encountered:
对于第一个问题,比方说一个优先级为1(0为优先级最高)的任务 t1 正在运行,也就说明当前就绪队列中没有优先级比1更高的任务,优先级更高的任务不存在或者在阻塞队列中。t1 运行一段时间后,新增一个优先级为0的任务 t0,下次调度时new_tcb = ros_tcb_dequeue(current_tcb->priority); 会返回 t0 任务,并进行上下文切换,所以优先级更高的 t0 任务会抢占 t1 任务运行。
new_tcb = ros_tcb_dequeue(current_tcb->priority);
ROS 算是 preemptive multitasking,可以通过适当的编码方式实现 cooperative multitasking:
对于第二个问题,已经忘了当初写这段代码的本意是什么,如上所述,会进入该段逻辑,但是不存在需要删除TASK_TERMINATED的情况。反而造成 ROS是 preemptive multitasking,可能是当初没搞清概念。
Sorry, something went wrong.
LeeReindeer
No branches or pull requests
ROS/ros.c
Line 139 in 048799c
The text was updated successfully, but these errors were encountered: