Re: how does kernel manages stack for threads?

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

 



>
> Each thread has its own kernel stack.
> include/linux/sched.h:
> union thread_union {
>         struct thread_info thread_info;
>         unsigned long stack[THREAD_SIZE/sizeof(long)
> ];
> };
> If you look to the dup_task_struct() (from kernel/fork.c) function, you'll
> see the following:
> .............
> ti = alloc_thread_info(tsk);
>         if (!ti) {
>                 free_task_struct(tsk);
>                 return NULL;
>         }
>
>         err = arch_dup_task_struct(tsk, orig);
>         if (err)
>                 goto out;
>
>         tsk->stack = ti;
> ...............
> Pointer to thread_info stored in tsk->stack
>
>
> --
> Regards,
> Denis
>

Thank you very much for your answer and let me ask you one more question.
If that is the case with kernel stack, do we also then have another
stack for user space? It seems to me that there is only one for user
space for both threads. If so, can this be the issue in any way?
Thank you again for your kind answer and I am sorry to ask too many
questions. Have a great day!

YEH

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[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