Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've read in many places that Linux creates a kernel thread for each user thread in a Java VM. (I see the term "kernel thread" used in two different ways:

  1. a thread created to do core OS work and
  2. a thread the OS is aware of and schedules to perform user work.

I am talking about the latter type.)

Is a kernel thread the same as a kernel process, since Linux processes support shared memory spaces between parent and child, or is it truly a different entity?

share|improve this question

2 Answers 2

up vote 8 down vote accepted

There is absolutely no difference between a thread and a process on Linux. If you look at clone(2) you will see a set of flags that determine what is shared, and what is not shared, between the threads.

Classic processes are just threads that share nothing; you can share what components you want under Linux.

This is not the case on other OS implementations, where there are much more substantial differences.

share|improve this answer

Threads are processes under Linux. They are created with the clone system call, which returns a process ID that can be sent a signal via the kill system call, just like a process. Thread processes are visible in ps output. The clone call is passed flags which determine how much of the parent process's environment is shared with the thread process.

share|improve this answer
    
Thanks. I regret I could only accept one answer. –  espertus Feb 14 '12 at 18:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.