Re: Process adress space (during context/process switch) + VM question

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

 



On Fri, Aug 19, 2005 at 20:19:39 +0000, Vincenzo Mallozzi wrote:
> In Linux a thread is viewed as a common process, different from the others.
> I means that each thread have a different pid. The way you can recognize 
> threads is by controlling the memory descriptor. 
> For example, if you want to know if a process is a thread, you have to control 
> if its memory descriptor is shared with TWO other processes in the system 
> having TWO different pids.  To better explain this concept, I'll use an 
> example.
> 
> Suppose we are executing  a process with pid 100. At any point, this process 
> create a thread.
> The system creates a new process sharing resource with process 100. (for sake 
> of simplicity, I suppose its pid is 101). The created thread is not the one 
> created by process 100 but is the so called THREAD MANAGER. The thread 
> manager creates a new thread (pid 102) with which shares the meomry 
> descriptor and other resources.
> In other word, we have this situation:
> 
>                       100 (the process initially executing)
>                         |
>                         |
>                       101 (the thread manager)
>    |
>    |
>        102 (the thread created)
> 
> Now, suppose that the process 100 creates three threads. The situation 
> changes:
> 
> 
>                       100 (the process initially executing)
>                         |
>                         |
>                       101 (the thread manager)
>                   /    |   \
>         /        |     \
>           102      103    104  (the threads created)
> 
> As you can see, threads 102 103 and 104  are sons of 101 while 101 is son of 
> 100. Also, all the processes (from 100 to 104) share the same descriptor.
> Furthermore, the threads share also other resources, like terminal, files and 
> so on (but they can create new file, access new  tty, ....)
> The thread manager is created to better manage some tasks directed to all of 
> threads created. An example is the signals directed to the thread.
> I ignore the way it manages the signal, perhaps it redirect a signal to the 
> correct thread or to all of them. But, I'm really sure that a thread can 
> receive a signal that the other threads don't receive. This is due, perhaps, 
> to the different pid assigned to them.
> 
> I hope I've explained clearly it.

I believe it's actually the initial task, that is turned into the thread
manager. So it'd really be:

			100 (the thread manager)
	     +-------+---+---+-------+
	     |       |       |       |
	    101     102     103     104

Where the first thread_create, invoked from task 100, actually returns to
task 101 and 102 is set to execute the function passed to task_create.

Because IIRC the "initial task" is required to be equal to all the other
threads created.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[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