mini_send() & mini_receive() - Minix

This is a discussion on mini_send() & mini_receive() - Minix ; I have a question about the message passing mechanism of Minix. When a process does a send to a destination which is not waiting for a message from this sender, the sender gets blocked. The function mini_send() checks wether the ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: mini_send() & mini_receive()

  1. mini_send() & mini_receive()

    I have a question about the message passing mechanism of Minix.

    When a process does a send to a destination which is not waiting for a
    message from this sender, the sender gets blocked. The function
    mini_send() checks wether the destination is blocked waiting for a
    message. If its not, mini_send() does the following:

    1) Marks the sender as blocked on a SEND.
    2) Removes the sender from the ready queue.
    3) Adds the sender to the destination's caller queue.

    Having done this, the process sending the message should not continue
    executing and give up the CPU. Where is the code that does this? The
    function mini_send() simply returns to the caller.

    Thanks,
    Waqar.


  2. Re: mini_send() & mini_receive()

    waqar wrote:
    > I have a question about the message passing mechanism of Minix.


    > When a process does a send to a destination which is not waiting for a
    > message from this sender, the sender gets blocked. The function
    > mini_send() checks wether the destination is blocked waiting for a
    > message. If its not, mini_send() does the following:


    > 1) Marks the sender as blocked on a SEND.
    > 2) Removes the sender from the ready queue.
    > 3) Adds the sender to the destination's caller queue.


    > Having done this, the process sending the message should not continue
    > executing and give up the CPU. Where is the code that does this? The
    > function mini_send() simply returns to the caller.


    IIRC (this is from OS class two years ago), at least part of mini_send()
    is processed inside the kernel. The sending process is removed from the
    ready queue (step 2 in your list), which means that the scheduler will not
    run the process anymore until its message has been received (at which time
    it is take out of the destintion's caller queue and put back in the ready
    queue). After all this has been done, right before going back to user mode
    and returning to the caller, the scheduler is run again and the process
    that just performed a mini_send() will not be scheduled again (because it
    is not in the ready queue). Therefore, the return statement will not be
    executed until the message has been delivered, which is exactly the
    behavior you would expect.

    Regards,

    Jens de Smit

    --
    Jens de Smit
    Student Computer Science | Vrije Universiteit Amsterdam
    jfdsmit@few.vu.nl | http://www.few.vu.nl/~jfdsmit

+ Reply to Thread