繁体   English   中英

在Linux内核编程中进行CPU SRJF调度时发生En / Dequeue错误

[英]En/Dequeue error occured when make CPU SRJF scheduling in Linux Kernel Programming

我想制作SRJF计划源。 但是它不能正常工作。 编译是可以的,但是我无法正确获得预期的结果。 如何修复或修改? 我认为入队部分和出队部分有误。

struct sched_array {
  struct list_head list;
  struct task_struct task;
};

void enqueue_task(struct task_struct *p, struct sched_array *array)
{
  struct sched_array *new = (struct sched_array *) malloc( sizeof(struct sched_array) );
  p->array = new;
  new->task = p;
  list_add( &new->list, &array->list )
}

void dequeue_task(struct task_struct *p, struct sched_array *array)
{
  if (rq->curr = p)
  {
    rq->curr = NULL;
  }
  list_del(&(p->array->list));
}

我在这里看到的一个问题是,

  new->task = p;

您正在分配p型的struct task_struct *task型的struct task_struct

注意p是指针,而task不是。

也许你是说

  new->task = *p;

然而,我们需要最小限度的可重现示例来完全解决问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM