Implementing new scheduling algorithm - Minix

This is a discussion on Implementing new scheduling algorithm - Minix ; Could anyone with Minix 3 programming experience enlighten me whether rewriting the scheduling algorithm can be achieved only by changing functions like enqueue(), dequeue(), sched(), pick_proc() in /usr/src/kernel/proc.c and maybe by adding some extra fields to the proc structure in ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Implementing new scheduling algorithm

  1. Implementing new scheduling algorithm

    Could anyone with Minix 3 programming experience enlighten me whether
    rewriting the scheduling algorithm can be achieved only by changing
    functions like enqueue(), dequeue(), sched(), pick_proc() in
    /usr/src/kernel/proc.c and maybe by adding some extra fields to the
    proc structure in /usr/src/kernel/proc.h so that I can store some extra
    scheduling data?

    Thanks in advance.


  2. Re: Implementing new scheduling algorithm

    All,

    On 14 Dec 2005 06:54:02 -0800, socket wrote:
    > Could anyone with Minix 3 programming experience enlighten me whether
    > rewriting the scheduling algorithm can be achieved only by changing
    > functions like enqueue(), dequeue(), sched(), pick_proc() in
    > /usr/src/kernel/proc.c and maybe by adding some extra fields to the
    > proc structure in /usr/src/kernel/proc.h so that I can store some extra
    > scheduling data?


    Yes, you can.

    .. enqueue/dequeue puts/removes a process in/from the lists of runnable
    processes.
    .. sched decides where to enqueue a runnable process - in which priority
    queue, and in which position on that queue.
    .. pick_proc decides which process to run next.

    So the actual scheduling decision is taken in pick_proc, based on data
    structures maintained by enqueue and dequeue.

    =Ben



  3. Re: Implementing new scheduling algorithm

    Thanks for the quick reply, Minix comunity seems to be one of its best
    assets.

    I'd like to add an extra proc structure field called "char p_abuse"
    (defined in proc.h) to account for consecutive priority penalties
    imposed on a "selfish" process which I'll then update inside the
    sched() function whenever a process exceeds its quantum twice in a row.

    Where in the source tree should I initialize this field?

    Though I realize kernel tasks get their properties initialized in
    /usr/src/kernel/main.c I'd like to know where user land tasks are
    initialized.

    Thanks in advance.


  4. Re: Implementing new scheduling algorithm

    All,

    > Where in the source tree should I initialize this field?
    >
    > Though I realize kernel tasks get their properties initialized in
    > /usr/src/kernel/main.c I'd like to know where user land tasks are
    > initialized.


    They're inherited from their parent when fork()ing. For the user
    processes, that's from init.

    =Ben



  5. Re: Implementing new scheduling algorithm

    Indeed.

    I figured that out just after posting, that was a lame question from
    me.


+ Reply to Thread