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.
Re: mini_send() & mini_receive()
waqar <waqar.shk@gmail.com> wrote:[color=blue]
> I have a question about the message passing mechanism of Minix.[/color]
[color=blue]
> 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:[/color]
[color=blue]
> 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.[/color]
[color=blue]
> 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.[/color]
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
[email]jfdsmit@few.vu.nl[/email] | [url]http://www.few.vu.nl/~jfdsmit[/url]