LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to tell if a program is running User Side or not? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-tell-if-a-program-is-running-user-side-or-not-4175482107/)

supasoaker 10-25-2013 05:55 AM

How to tell if a program is running User Side or not?
 
Well, the question is pretty much in the title. I have searched around and looked in some books but cannot find reference to this.

Is it possible to tell if a program is running User Side? Is it also possible to monitor if a program asks for and gets access to the kernel side or not?

Sorry if my terminology is a little off, please let me know if you need me to rephrase.

Related Issue: Anyone have any links to information about scheduling in Linux and maybe even how it can be modified? Maybe not a best practice, but interesting to be aware of. I have found this link below but am unsure if it will change the scheduling system for the ENTIRE system:

http://linuxmanpages.net/manpages/fe...heduler.2.html

I can read but am looking for confirmation, sorry for the two part question. Thanks in advance for any help!

rtmistler 10-25-2013 07:47 AM

To try to answer the first part of the question which is to know whether or not a program is running, it depends on the environment from which you are querying. I.e. from the shell you can perform a search for the process using the "ps" command with arguments. You can also search for the command line of that program under the /proc tree, and likely that is how I'd progress if I did it via a program. I'd write a bash script, passing it a name argument; intended to be the process name I was searching for, perform the shell based searching actions in that script and return to my calling program, the result.

As far as the kernel access goes, I'm kind of weak on that except if I were coding the process I could add debug to let me know this. I'll have to leave this part up to another responder.

bill_from_tampa 10-28-2013 05:49 PM

One way: run a program called "htop" in a console. It is an expanded version of "top". It will list all running programs (you can space down) and gives much info about each one, including which user ran it. You can find any specific program using the F4/find command within htop. Note that "root" is the name of the superuser in linux, so programs with root as the user have superuser permissions. Operating system programs launched by the kernel or a kernel module would run as "root", but you could also run a program as "root" bu using su or sudo to launch it. I hope this is what you were asking about!


All times are GMT -5. The time now is 02:45 AM.