Find the answer to your Linux question:
Results 1 to 4 of 4
Hello, is there a way to know if a process has been interrupted by the scheduler during his execution? I need to collect this info after the execution of the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2012
    Posts
    3

    Scheduler process info


    Hello, is there a way to know if a process has been interrupted by the scheduler during his execution? I need to collect this info after the execution of the process itself. In other words, is there a way to get the file proc/pid/status after the dead of the process?

    Sorry for my bad english.

    Stefano

  2. #2
    Just Joined!
    Join Date
    May 2012
    Posts
    9
    Hi

    Can you please try with this "echo $?" . For example

    root@alex:# ls -l
    total 4
    -rw-r--r-- 1 root root 642 May 27 13:00 test.php

    To see the previous command has successfullly executed or not you can use

    "echo $?" and therefore the result will be

    root@alex:# echo $?
    0

    For a unsuccessful execution of command or a script the result will be

    root@alex:~# ls -T
    ls: option requires an argument -- 'T'
    Try `ls --help' for more information.

    This command is unsuccessful so the result will be

    root@alex:~# echo $?
    2

    By this way you can check the script or command has been successfully completed or not

    Regards
    Velan-support

  3. #3
    Just Joined!
    Join Date
    May 2012
    Posts
    3
    Quote Originally Posted by velan-support View Post
    Hi

    Can you please try with this "echo $?" . For example

    root@alex:# ls -l
    total 4
    -rw-r--r-- 1 root root 642 May 27 13:00 test.php

    To see the previous command has successfullly executed or not you can use

    "echo $?" and therefore the result will be

    root@alex:# echo $?
    0

    For a unsuccessful execution of command or a script the result will be

    root@alex:~# ls -T
    ls: option requires an argument -- 'T'
    Try `ls --help' for more information.

    This command is unsuccessful so the result will be

    root@alex:~# echo $?
    2

    By this way you can check the script or command has been successfully completed or not

    Regards
    Velan-support

    First of all, thank you for the answer. I am not trying to see if the program is executed well or not (I assume it is), I want to know if during its life cycle it has been preempted by the scheduler. Maybe I had to use "preempted" instead of "interrupted" in the first post.

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    May 2012
    Posts
    3
    I think I've found the solution. I post the link in case someone needs too: stackoverflow.com/questions/9286009/context-switch-on-a-process

Posting Permissions

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