L 5.12:   Receiver finds sender ready:  pending_receive_only

(Revision 0 - 16 October 2000)

 

overview - handle a pending send for this receiver

get here after a restart form receive_only prologue if there's a pending sender (in sendQ)

on entry      t0  has tcb of first sender in sendQ (L5.9 l0 p58)

0 if receiver is waiting for a message from anyone, goto 6 to do receiver setup/sender resumption
1-4 loop thru tcbs in sendQ to see if one of them is the sender this receiver is waiting for a message from
5 if no sender matches goto l2 L5.9 (receive_only prologue) to put self in wait state
6,7 store receive descriptor and timeout in caller's tcb (needed for long ipc) - [note: caller's tcb is pointed at by stcb - but caller is a receiver!!]
8,9 context switch to sender thread
10,11 invoke pending_restart (L5.6 p55) in sender thread's context
recall:  TOS <-- pending_restart   (l38 L5.5 pending p.54)
pending_restart will restore needed parts of sender's context and (for short ipc) invoke deliver part of k_ipc
k_ipc (or send_only_short) will do sender's delivery processing and switch back to receiver's context with message


Notes:

1.    There are 2 limited context switches here - receiver to sender and then sender back to receiver
2.    This can all be done in receiver's timeslice - without invoking the scheduler. Professor Heiser calls this "lazy scheduling"