Doubt regarding currentPID sending as an argument

10 views
Skip to first unread message

karamsetty vishnu

unread,
Oct 7, 2025, 11:11:55 AM (3 days ago) Oct 7
to XOS Users
While calling Device Manager , Resource manager modules we are sending current PID of the process as in R2 register in most of the calls.

Why are we sending current PID as an argument ?. we can just refer System status table for getting the current pid of process

Murali Krishnan

unread,
Oct 7, 2025, 3:00:10 PM (3 days ago) Oct 7
to xos-...@googlegroups.com
Consider the following situation.
Process A is running in user mode.  In the meanwhile, assume that process B has been in wait state, after having issued a disk read some time back. 
Suppose that the disk transfer is complete now, and the disk controller raises the interrupt.
The processor will switch to the disk interrupt handler code.  Let us look at the scenario inside the handler.   
The interrupt handling is doing actions required for process B, although the system status table will hold the PID of process A.  
(In OS jargon, we say that the interrupt handling of process B takes place in the context of process A). 
Any subroutine calls  made from the disk interrupt handler must pass the information to the callee function that call is for getting work done for process B - not process A.  
Hence, at the design level of the kernel, the calling convention of passing the PID has been made uniformly, for most subroutine invocations within the kernel. 
In eXpOS, calls to another routine from an interrupt handler is unlikely. -  but explicitly passing the PID is a safer interface design. 
This reduces the chances of kernel code errors, where the callee function is making updates on the data structures of the wrong process.   
Moreover, at the time of the design, the team had to look into the scalability of the interfaces for future enhancements as well. 
Thus, the particular calling convention is more of a design level choice, made on general software engineering principles.    




On Tue, Oct 7, 2025 at 8:41 PM karamsetty vishnu <vishnukara...@gmail.com> wrote:
While calling Device Manager , Resource manager modules we are sending current PID of the process as in R2 register in most of the calls.

Why are we sending current PID as an argument ?. we can just refer System status table for getting the current pid of process

--
You received this message because you are subscribed to the Google Groups "XOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xos-users+...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/xos-users/22862cdf-a197-4931-a0bb-c9cf76ff908en%40googlegroups.com.

karamsetty vishnu

unread,
Oct 8, 2025, 5:20:09 AM (2 days ago) Oct 8
to XOS Users
understood sir , thank you.
Reply all
Reply to author
Forward
0 new messages