Find the answer to your Linux question:
Results 1 to 4 of 4
Hello, I want to have a real-time process take over my computer I've been playing a bit with this. I created a process which is essentially a while (1) (never ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2010
    Posts
    2

    Is it possible to hang the computer with a SCHED_FIFO process?


    Hello,
    I want to have a real-time process take over my computer

    I've been playing a bit with this. I created a process which is essentially a while (1) (never blocks nor yields the processor) and used schedtool to run it with SCHED_FIFO policy. However, the process was letting other processes run as well.

    Then someone told me about sched_rt_runtime_us and sched_rt_period_us. So I set the runtime to -1 in order to make the real-time process take over the processor, but it didn't work either.

    I'm on Linux 2.6.27-16-server, in a virtual machine with just one CPU. What am I doing wrong?

    Thanks,

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    11,159
    Assuming your process is doing nothing (while (1){}) then the system is free to schedule other processes. In a well-designed system (real-time or otherwise), it should not be possible to hang the system with mal-behavior of one process. Remember, interrupts have priority. All processes in the RT pool will have proportional access (depending upon their RT priority) to the system and hardware. Some system processes will also be scheduled as RT processes. In any case, even RT processes in Linux are not truly real-time. Linux can only approximate RT, so it is what I call "soft" real-time, not hard real-time. For that, you need a true real-time operating system, such as VxWorks, QNX, etc.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Aug 2010
    Posts
    2
    Quote Originally Posted by Rubberman View Post
    Assuming your process is doing nothing (while (1){}) then the system is free to schedule other processes. In a well-designed system (real-time or otherwise), it should not be possible to hang the system with mal-behavior of one process. Remember, interrupts have priority. All processes in the RT pool will have proportional access (depending upon their RT priority) to the system and hardware. Some system processes will also be scheduled as RT processes. In any case, even RT processes in Linux are not truly real-time. Linux can only approximate RT, so it is what I call "soft" real-time, not hard real-time. For that, you need a true real-time operating system, such as VxWorks, QNX, etc.
    According to man 2 sched_setscheduler:
    A SCHED_FIFO process runs until either it is blocked by an I/O request, it is preempted by a higher priority process, or it calls sched_yield(2).
    So I understand that a while(1) in SCHED_FIFO should stay running forever, since the kernel won't preempt it.

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    11,159
    Maybe. It depends upon what the compiler does. Often, do-nothing loops like this are compiled into no-ops, so in such a special case, all bets are off.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

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