How to print ready processes ?? - Minix

This is a discussion on How to print ready processes ?? - Minix ; Hi All, I am trying to print all the processes from the ready queue by pressing a function key. Here is the approach that i used: I identified an unused function key(F8) from /usr/src/servers/is/dmp.c and mapped that function key to ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: How to print ready processes ??

  1. How to print ready processes ??

    Hi All,
    I am trying to print all the processes from the ready queue by
    pressing a function key.

    Here is the approach that i used:
    I identified an unused function key(F8) from
    /usr/src/servers/is/dmp.c and mapped that function key to the procedure
    readytab_dmp in /usr/src/servers/is/dmp_kernel.c .In this procedure i
    tried to identify the ready processes.

    for (int q = 0; q < NR_SCHED_QUEUES; q++)
    {
    if(rdy_head[q]==NIL_PROC)
    {
    printf("The rdy_head[%d] is NULL\n",q);
    }
    for (process = rdy_head[q]; process != NIL_PROC; process =
    process->p_nextready)
    printf("%s", process->p_name);
    }

    I am trying to traverse rdy_head to find all the currect ready
    processes.According to MINIX 3 documentation source rdy_head is defined
    in /usr/src/kernel/proc.h as pointers to ready list headers.

    I am getting all the rdy_head values as NULL.

    I have the following questions:

    1.Why am i getting all the values for the rdy_head as NULL??
    2.Is /usr/src/servers/is/dmp_kernel.c is the correct place to call
    rdy_head array??

    Any help is greatly appreciated.

    Thanking you in advance,
    Shanthi.


  2. Re: How to print ready processes ??

    prashanthi.chennupati@gmail.com wrote:
    > Hi All,
    > I am trying to print all the processes from the ready queue by
    > pressing a function key.
    >
    > Here is the approach that i used:
    > I identified an unused function key(F8) from
    > /usr/src/servers/is/dmp.c and mapped that function key to the procedure
    > readytab_dmp in /usr/src/servers/is/dmp_kernel.c .In this procedure i
    > tried to identify the ready processes.
    >
    > for (int q = 0; q < NR_SCHED_QUEUES; q++)
    > {
    > if(rdy_head[q]==NIL_PROC)
    > {
    > printf("The rdy_head[%d] is NULL\n",q);
    > }
    > for (process = rdy_head[q]; process != NIL_PROC; process =
    > process->p_nextready)
    > printf("%s", process->p_name);
    > }

    This only lists ready procs. As only a small number of unblocked
    processes are ready they will be run quickly until they are blocked.

    You could fire up a few procs to load the system first.

    # while :; do :; done &
    # a few times

    F4 shows
    30 (00) sh P-B-- E--B- 00010111 00000000 00000000 00000000
    (I'll RTFM&C to find out what F4 does.)

    ps -l shows
    0 R 0 105 98 98 180 co 4:46 -sh

    >
    > I am trying to traverse rdy_head to find all the currect ready
    > processes.According to MINIX 3 documentation source rdy_head is defined
    > in /usr/src/kernel/proc.h as pointers to ready list headers.
    >
    > I am getting all the rdy_head values as NULL.

    Does this mean the list is empty?
    >
    > I have the following questions:
    >
    > 1.Why am i getting all the values for the rdy_head as NULL??
    > 2.Is /usr/src/servers/is/dmp_kernel.c is the correct place to call
    > rdy_head array??
    >
    > Any help is greatly appreciated.
    >
    > Thanking you in advance,
    > Shanthi.
    >


  3. Re: How to print ready processes ??

    All,

    Firstly, do you realise the functionality you want is already in IS, in
    dmp_kernel.c:sched_dmp() ? As you can see in dmp.c, it's mapped to F9.

    (In minix 3.1.1.)

    > I have the following questions:
    >
    > 1.Why am i getting all the values for the rdy_head as NULL??


    How are you retrieving them? As IS doesn't share the address
    space with the kernel, IS doesn't know anything about the
    scheduling queues.

    > 2.Is /usr/src/servers/is/dmp_kernel.c is the correct place to call
    > rdy_head array??


    Yes, but you have to get a copy of the arrays from the kernel,
    they don't get filled in by magic .

    =Ben



  4. Re: How to print ready processes ??

    sched_dmp() does the automatic filling of the arrays. Am I correct.


  5. Re: How to print ready processes ??

    sched_dmp() does the automatic filling of the arrays. Am I correct?


  6. Re: How to print ready processes ??

    All,

    On 2 Mar 2006 07:23:15 -0800, Abhinav Sarna wrote:
    > sched_dmp() does the automatic filling of the arrays. Am I correct.


    You are correct, but it also prints the ready processes, so now I'm
    wondering why you want to print the ready processes

    =Ben



+ Reply to Thread