Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

Why is getpid implemented as a system call?

$
0
0

I'm in the middle of taking my first OS class, so hopefully I don't have any big misconceptions here.

I was wondering why getpid() is implemented as a system call in Linux. As I understand it, certain functions are made into system calls because they access or change information that the OS might want to protect, so they are implemented as a system call in order to transfer control to the kernel.

But as I understand it, getpid() is just returning the process id of the calling process. Is there any case where permission for this information wouldn't be granted? Wouldn't it be safe to simply let getpid() be a normal user function?

Thanks for the help.


Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>