All of lore.kernel.org
 help / color / mirror / Atom feed
* kernel thread priority over user thread
@ 2016-12-20  7:02 Ran Shalit
  2016-12-20 12:30 ` Mulyadi Santosa
  0 siblings, 1 reply; 2+ messages in thread
From: Ran Shalit @ 2016-12-20  7:02 UTC (permalink / raw)
  To: kernelnewbies

Hello,

I am trying to understand if kernel thread are always higher priority
then user thread.

Say, a kernel thread (created with kthread_create with SCHED_FIFO and
given priority x), and user thread (created with pthread_create was
created with SCHED_FIFO and given priority y), and priority of pthread
is higher than kthread, would still the kernel thread get into
scheduler before the user thread ?
How is the scheduler decides which get first into the running state ?

Regards,
Ran

^ permalink raw reply	[flat|nested] 2+ messages in thread

* kernel thread priority over user thread
  2016-12-20  7:02 kernel thread priority over user thread Ran Shalit
@ 2016-12-20 12:30 ` Mulyadi Santosa
  0 siblings, 0 replies; 2+ messages in thread
From: Mulyadi Santosa @ 2016-12-20 12:30 UTC (permalink / raw)
  To: kernelnewbies

On Tue, Dec 20, 2016 at 2:02 PM, Ran Shalit <ranshalit@gmail.com> wrote:

> Hello,
>
> I am trying to understand if kernel thread are always higher priority
> then user thread.
>
> Say, a kernel thread (created with kthread_create with SCHED_FIFO and
> given priority x), and user thread (created with pthread_create was
> created with SCHED_FIFO and given priority y), and priority of pthread
> is higher than kthread, would still the kernel thread get into
> scheduler before the user thread ?
> How is the scheduler decides which get first into the running state ?
>
> Regards,
> Ran
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

Dear Ran

Tough question, but let me clarify, when you mean higher, do you mean y > x?

All in all, kernel thread and user thread is treated the same in the
kernel's point of view. So in your case, unless one of them voluntarily
give up his time slice, or preempted by certain case, thread with higher
priority will be picked by scheduler first

CMIIW

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161220/c189083a/attachment-0001.html 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-20 12:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-20  7:02 kernel thread priority over user thread Ran Shalit
2016-12-20 12:30 ` Mulyadi Santosa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.