0

私は vmware プレーヤーに minix 3 をインストールしました。私が読んだように、ファイル "proc.c" の /usr/src/kernel にある関数を見つけようとしています。この関数は sched() と呼ばれます。

この 2 つの関数の間にある必要があります。

 /*===========================================================================*
     *              dequeue                      * 
     *===========================================================================*/
    void dequeue(struct proc *rp)
    /* this process is no longer runnable */
    {
    /* A process must be removed from the scheduling queues, for example, because
     * it has blocked.  If the currently active process is removed, a new process
     * is picked to run by calling pick_proc().
     *
     * This function can operate x-cpu as it always removes the process from the
     * queue of the cpu the process is currently assigned to.
     */
      int q = rp->p_priority;       /* queue to use */
       struct proc **xpp;           /* iterate over queue */
      struct proc *prev_xp;
       u64_t tsc, tsc_delta;

      struct proc **rdy_tail;

     assert(proc_ptr_ok(rp));
      assert(!proc_is_runnable(rp));

  /* Side-effect for kernel: check if the task's stack still is ok? */
  assert (!iskernelp(rp) || *priv(rp)->s_stack_guard == STACK_GUARD);

  rdy_tail = get_cpu_var(rp->p_cpu, run_q_tail);

  /* Now make sure that the process is not in its ready queue. Remove the 
   * process if it is found. A process can be made unready even if it is not 
   * running by being sent a signal that kills it.
   */
  prev_xp = NULL;               
  for (xpp = get_cpu_var_ptr(rp->p_cpu, run_q_head[q]); *xpp;
          xpp = &(*xpp)->p_nextready) {
      if (*xpp == rp) {             /* found process to remove */
          *xpp = (*xpp)->p_nextready;       /* replace with next chain */
          if (rp == rdy_tail[q]) {      /* queue tail removed */
              rdy_tail[q] = prev_xp;        /* set new tail */
      }

          break;
      }
      prev_xp = *xpp;               /* save previous in chain */
  }


  /* Process accounting for scheduling */
  rp->p_accounting.dequeues++;

  /* this is not all that accurate on virtual machines, especially with
     IO bound processes that only spend a short amount of time in the queue
     at a time. */
  if (!is_zero64(rp->p_accounting.enter_queue)) {
    read_tsc_64(&tsc);
    tsc_delta = sub64(tsc, rp->p_accounting.enter_queue);
    rp->p_accounting.time_in_queue = add64(rp->p_accounting.time_in_queue,
        tsc_delta);
    make_zero64(rp->p_accounting.enter_queue);
  }


#if DEBUG_SANITYCHECKS
  assert(runqueues_ok_local());
#endif
}

*このように/ ============================================= =============================* *スケジュール* ================= ================================================== ======== /

                       it should be here but is missing**




/*===========================================================================*
 *              pick_proc                    * 
 *===========================================================================*/
static struct proc * pick_proc(void)
{
/* Decide who to run now.  A new process is selected an returned.
 * When a billable process is selected, record it in 'bill_ptr', so that the 
 * clock task can tell who to bill for system time.
 *
 * This function always uses the run queues of the local cpu!
 */
  register struct proc *rp;         /* process to run */
  struct proc **rdy_head;
  int q;                /* iterate over queues */

  /* Check each of the scheduling queues for ready processes. The number of
   * queues is defined in proc.h, and priorities are set in the task table.
   * If there are no processes ready to run, return NULL.
   */
  rdy_head = get_cpulocal_var(run_q_head);
  for (q=0; q < NR_SCHED_QUEUES; q++) { 
    if(!(rp = rdy_head[q])) {
        TRACE(VF_PICKPROC, printf("cpu %d queue %d empty\n", cpuid, q););
        continue;
    }
    assert(proc_is_runnable(rp));
    if (priv(rp)->s_flags & BILLABLE)       
        get_cpulocal_var(bill_ptr) = rp; /* bill for system time */
    return rp;
  }
  return NULL;
}

私は minix_R3.2.1-972156d を使用しています。何かわかる人いますか???

4

3 に答える 3

2

おっさん、この関数は minix 3.1 ブック バージョンにあるかもしれません。これは公式リンクです: http://download.minix3.org/iso/minix-3.1.0-book.iso.bz2

ソースコードはこちら: http://www.minix3.org/documentation/AppendixB.html

于 2016-03-28T22:51:58.863 に答える
1

sched3.2を使用している間、Minix 3.1にはありました。これら 2 つのバージョンの間にはかなりの変更が加えられています。実際、 でcscope検索しましたが/srcschedどこにも見つかりません。

于 2016-11-06T13:00:23.583 に答える
1

関数は、おそらく最新の minix ビルドで別の場所に移動されます。#include手始めに、proc.c の先頭で定義されている各ファイルを調べます。

于 2013-05-23T03:56:16.627 に答える