Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   C (https://www.askmehelpdesk.com/forumdisplay.php?f=438)
-   -   Round robin program (https://www.askmehelpdesk.com/showthread.php?t=199426)

  • Mar 27, 2008, 07:28 PM
    amnw
    Round robin program
    hi . Experts..
    my teacher asked me to simulation of round robin as the following :
    1- struct for a new process (Busrt Time,Priority and pointer to the next node)
    2- struct for pointers (Head ,Tail), pointing to the head and tail of this queue
    3- main segment (create a thread for function generator)
    4- Generator
    Create a process of type new process
    get random value for burst(<100)
    get random value for priority(0,1,2)
    set the nextnode pointer = NULL

    5- queuing function
    Take the new process
    Put it in the end of the queue
    No more than one process can call this function
    Cautions:
    process one enter to be inserted to the gueue others wait until it finished
    first come first serve
    if the queue is full( mening no more space to creat a new process let the generator sleep until one process is removed from the queue)

    My problem is with the caution part I don't knoe how to make the function (put in queue) called for only one process at time
    and I don't know how to check if the queue is full and how to let the generator thread sleep


    Please help me
    thank you

  • All times are GMT -7. The time now is 03:08 PM.