The "glo.h" file in the pm's directory defines a pointer to the slot in the process table (the pm's table) for the current process; i.e., the user process that has sent a message to the pm process.
struct mproc * mp;
The header file also declares several important global pm variables that are filled in for each message that is received:
message m_in; int who_e; int who_p; int call_nr;
The process manager repeatedly tries to receive a message from any (user) process by calling a function: get_work.
This function calls receive, which will block until some message is sent to the process manager.
Once a message is received, the get_work function extracts information from the message about the sender and assigns values to:
- m_in - where the incomming message is placed by the kernel.
- mp - pointer to the process table entry of the user who sent the message
- who_e - the endpoint value of the same user
- who_p - the index of this user's entry in the process table.
- call_nr - the number of the user requested system call
The get_work function makes a check that the process table entry at index who_p is still being used by the user who sent the message.