Re: Scheduler - kernel threads - threads - processes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 23, 2002 at 11:09:28AM +0200, Wank Rainer wrote:
> Hi,
> 
> the Linux scheduler has three policies SCHED_FIFO, SCHED_RR and SCHED_OTHER.
> SCHED_FIFO and SCHED_RR are for realtime requirements.
> The kernel is not preemptive. That means that a process running in kernel mode can not
> be preempted.

It can't be preempted (unless preempt patches are in, AFAIK they are in
2.5 and 2.4 version is available), but it often calls schedule.
Scheduler behaves the same weather schedule was called from kernel-mode
code (syscall or kernel thread) or from timer interrupt.

> There are also kernel threads, like [kswapd].  Does a kernel thread have a priority?
> How does the scheduler schedule kernel threads?

Sure they do. They are scheduled just as any other processes. Just they
have to call schedule themselves.

> On the other hand a process can also have several threads.

Threads are separate processes at least from scheduler point of view.
They have their own taks_structs so they are scheduled independently
(that is, threads created using clone syscall like pthred library uses -
there are many thread libs doing threads in userspace, but that has
disadvantage of blocking whole app on a single syscall (many syscalls
can't be interrupted and signal delivery waits until they finish).)
Don't know how it is with dynamic priority accounting however.

> How does the scheduler schedule these threads in contrast to kernel threads or processes?

All the same. Since they are all the same. Threads are just processes
that share memory map and filehandles etc. Kernel threads are just
processes that have no memory map at all and execute only kernel code.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux