0

If a system call is made for a process and sitting in kernel mode, if 2 threads are created then

a)how are the stacks for each thread is created in kernel?

b)If one of the thread switch back to user mode and if the other thread remain in kernel mode then will I loose the kernel data(local) allocated by parent thread?

c)why the two threads created has different pid?

0

After going through much digging in kernel, and working in a project related to the same topic I found:

a)Yes each kthread has its stack which vary from architecture like 8k, 4k

b)Yes I will loose the local of the one of the thread if it make switch back to user space as the kernel stack becomes empty, however if we declare a global variable and exern that variable will make that thread available in the other thread. Moreover it should be noted that the whole kernel has only 1 data segment

c)The two threads has different pid because the two threads are two different process in kernel context add they are represent by [] in ps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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