09-18-05 10:55 PM
rahul8143@gmail.com wrote:
>
> hello,
> How linux schedules,executes processes and threads with respect to
> OS? I mean if say process A is executing then if it creates 2 threads
> and similaraly there are other processes in system currently then how
> OS schedules them?
They are scheduled like all other threads on the system.
Each thread get a time slice, the higher the nice value is
the shorter a slice the thread gets. The scheduler will try
to give threads sharing address space their slices just after
each other to reduce the number of TLB flushes.
> Also does each thread of a process has a its PID? Does in a
> multithreaded program all its threads have PID?
Each thread have an ID, not all people agree on what to call
that ID. You can get both the ID of the individual thread and
the ID of the group. The getpid() system call used to give
the ID of the thread, but in newer kernels give the ID of the
group.
--
Kasper Dupont
Note to self: Don't try to allocate
256000 pages with GFP_KERNEL on x86.
[ Post a follow-up to this message ]
|