Find the answer to your Linux question:
Results 1 to 4 of 4
Hello to all! I am a new Linux user and I would really appreciate any help you can provide me in order to clarify some things regarding application running in ...
  1. #1
    Just Joined!
    Join Date
    Jul 2008
    Posts
    6

    User-space application running

    Hello to all!
    I am a new Linux user and I would really appreciate any help you can provide me in order to clarify some things regarding application running in Linux.

    I have successfully compiled the below Hello World program:

    Code:
    #include <stdio.h>
    
    int main() 
    {
    printf("Hello world!\n");
    
    return 0;
    }
    and I got an executable named "hello.out"

    When I am running the application by typing into bash:
    Code:
    $./hello.out
    I am getting the "Hello world" message however I have a few questions regarding the involve of kernel scheduler to this application execution.

    1) In this case I am running a function from user space without using any of the scheduler routines in order to e.g. add the task to scheduler "run queue" list or to specify the priority of this execution so I can't understand how the scheduler is invoked to the execution of the program without using any of the scheduler's routines in order to provide information about this execution. (how the scheduler knows about the existence of this application?)

    What's the process in order finally the task to be executed?

    2) How can I have a periodic execution of the application?

    3) What's the priority of this execution? Is there a way to see all the applications that kernel scheduler runs and how often?

    4) If I was running two applications, which one would be running first? Could I change the priority of its execution somehow?

    Any help would be really appreciated.
    Thank you!

  2. #2
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    Hello,

    Quote Originally Posted by limp View Post
    1) In this case I am running a function from user space without using any of the scheduler routines
    You tell your shell interpreter (bash?) to do this for you.
    I assume the shell uses any of the execl runtime functions which in turn
    load the binary into ram and tell the kernel about it.

    Kompf.de - POSIX Library Functions
    Runtime library - Wikipedia, the free encyclopedia



    Quote Originally Posted by limp View Post
    2) How can I have a periodic execution of the application?
    Most easily via a shell script which executes the application periodically.
    Linux Shell Scripting Tutorial - A Beginner's handbook

    Quote Originally Posted by limp View Post
    3) What's the priority of this execution? Is there a way to see all the applications that kernel scheduler runs and how often?
    You mean the 'top' and 'ps -aux'?

    Quote Originally Posted by limp View Post
    4) If I was running two applications, which one would be running first?
    Could I change the priority of its execution somehow?
    Isn't Linux a multitasking kernel?
    You might want to look into 'nice'. (not the French town but the command/function)

  3. #3
    Just Joined!
    Join Date
    Jul 2008
    Posts
    6
    You preety much solved all of my problems! Thank you!

    However, I am trying to have a little bit diper understanding of how the bash communicates with the scheduler in order the latest to execute the application.

    There should be some specific system calls I suppose.

    I searched for the "./" command that I use in bash in order to execute an application but I didn't found any information related with it.

    Thanks again!

  4. #4
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    Lol,
    the './' is no command. It refers to the current directory.

    This is due to how command line extension works:
    When you type in a command, say 'ls', the bash tries to find it in any of the directories that are listed in the 'PATH' environment variable.
    (Type 'echo $PATH' to see its content.)

    On my system it says:
    /usr/local/bin:/usr/bin:/bin:

    This means, when I start 'ls', the shell checks whether there is an executable "/usr/local/bin/ls".

    If not, the next path is tried:
    "/usr/bin/ls" etc.

    Because the default setting is to ignore files in the current directory (for security reasons), you have to explicitly state that you want Bash to execute the file in the directory you are now. (The dot is a shortcut for "current directory", the ~ is a shortcut for your home directory)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...