Re: How many kernel threads will be created

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

 



Ok. My turn -
 
User Process - There is nothing like kernel process. Its just user process, which sometimes executes in user mode and sometimes in kernel mode.
User Thread - Linux doesnt have the concept of thread. It does not implement threads separately. Thread is just a process for linux. However it shares address space with other processes.
Kernel thread - Special process, which always executes in kernel mode.
 
So while saying THREAD in linux world its meaning maybe KERNEL THREAD or just a flow of control actually.

>  Please clarify the following quetions?
>  1. How many kernel threads will be created for a user space process
> consists say 5 threads.
Mulyadi wrote -
 
>5 too... it's 1:1...please read Ulrich drepper NPTL paper on the
>rationale why it doesn't pick M:N or N:1 approach.
 
So if you create 5 user processes there will be 5 kernel threads. Note that in this context kernel thread is not a special process (what I described above) but it is just the flow of control (the general meaning of thread).
 
- A
 
On 4/16/08, ravikumar <ravikumar.vallabhu@xxxxxxxxx> wrote:
Michael Blizek wrote:
On 09:10 Wed 16 Apr     , ravikumar wrote:
  
Michael Blizek wrote:
    
On 20:57 Sun 13 Apr     , V.Ravikumar wrote:
  
      
Hello all,

Please clarify the following quetions?
1. How many kernel threads will be created for a user space process consists
say 5 threads.
    
        
Zero. Just 5 kernel stacks - one for every user space thread; This stack is
used when a user space thread executes a syscall. In the kernel this is
software interrupt context. On x86 systems which do not have the syscall
instruction the syscall is executed by moving the arguments in the register
and then executing "int 0x80". Do not mix it with SoftIRQ, this is something
completly different.

  
      
2. What is the differece btw linux kernel process and kernel thread.  I read
in linux there is no differece btw a kernel process and kernel thread
    
        
What is a kernel process? I thought Linux is a monolithic kernel and executes
everything in the same address space...
	-Michi
  
      
what is the diffrence btw process and kernel thread?
    
Threads belonging to the same process share the address space, namespace and
file descriptors. Processes do not.

Processes can use e.g. STDIN/STDOUT and System V IPC for communicating.

Threads usually use shared datastructures, which need to be *very* carefully
synchronized. This is often and done richt and leads to racing conditions and
deadlocks.
	-Michi
  

In the book 'Linux Kernel Development Second Edition By Robert Love' i found the following setence.
"Linux has a unique implementation of threads: It does not differentiate between threads and processes. To Linux, a thread is just a special kind of process."
Then how these two were implemented , just by setting necessary  flags for clone() system call.?
And one more question how kernel schedules threads and processes.


 


[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