Re: Preemptive linux



Rafael Almeida wrote:

I've written a system call like this:

int sys_foo(void) {
while (1);
return 0;
}

When I called it, however, the system hang and I was not able to do
anything besides restarting it.

Did you enable CONFIG_PREEMPT and recompile the kernel? It may not have been enbled by default.

> Wouldn't that mean that the kernel is
actually nonpreemptive, as if it were preemptive I would be able to get
back to the shell and kill the process?

With the code as shown, there's no way for you to kill the task once you go into that loop. You need an exit condition.

That said, with CONFIG_PREEMPT I *think* you should still be able to do other stuff on the system--it would just always be running at 100% cpu.

Chris
.



Relevant Pages

  • Re: [PATCH 1/4] Blackfin: arch patch for 2.6.18
    ... static inline void default_idle ... Do yourself a favour and kill the old-style signal infrastructure. ... +asmlinkage int sys_mmap(unsigned long addr, unsigned long len, ...
    (Linux-Kernel)
  • Re: [RFC] Enabling other oom schemes
    ... >> will panic on any oom condition ... extern int sysctl_lower_zone_protection; ... +static void black_list_parent ... * to kill when we run out of memory. ...
    (Linux-Kernel)
  • Re: Progress ... doing well with a lvl 14 MiBe... advice wanted (LONG)
    ... That Int is going to kill you. ... a - a +0,+2 executioner's axe of distortion ... Incredibly powerful, balanced by being incredibly dangerous to use. ...
    (rec.games.roguelike.misc)
  • Re: Signals and Net::Telnet::command
    ... > # Kill the long living command ... > My question is whether the 'INT' signal is delivered to the cmd being ... > What i observed was that kill, and waitpid were successful, but the ... 20018: Child, long command ...
    (comp.lang.perl.modules)
  • Re: [PATCH 0/4] pending scheduler updates
    ... things which need frequent preemption in order to compete effectively ... handler (int n) ... if (loop> 0) ... kill; ...
    (Linux-Kernel)