multithreading - Does linux schedule a process or a thread? -
after reading this question got few doubts. please in understanding.
scheduling involves deciding when run process , quantum of time.
does linux kernel schedule thread or process? process , thread not differentiated inside kernel how scheduler treats them?
how quantum each thread decided? a. if quantum of time (say 100us) decided process getting shared between threads of process? or b. quantum each thread decided scheduler?
note: questions 1 , 2 related , may same wanted clear on how things working posted them both here.
the linux scheduler (on recent linux kernels, e.g. 3.0 @ least) scheduling schedulable tasks or tasks.
a task may :
- a single-threaded process (e.g. created
fork
without thread library) - any thread inside multi-threaded process (including main thread), in particular posix threads (pthreads)
- kernel tasks, started internally in kernel , stay in kernel land (e.g.
kworker
,nfsiod
,kjournald
,kauditd
,kswapd
etc etc...)
in other words, threads inside application multi-threaded processes scheduled non-threaded -i.e. single threaded- processes.
the low-level clone(2) syscall creates user-land schedulable tasks (and can used both creating fork
-ed process or implementation of thread libraries, pthread). unless low-level thread library implementor, don't want use clone
directly.
afaik, multi-threaded processes, kernel (almost) not scheduling process, each individual thread inside (including main thread).
actually, there notion of thread groups , affinity in scheduling, don't know them well
these days, processors have more 1 core, , each core running task (at given instant) have several tasks running in parallel.
cpu quantum times given tasks, not processes
Comments
Post a Comment