Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 05-17-2005, 10:38 PM   #1
LQ Newbie
Registered: May 2005
Posts: 10

Rep: Reputation: 0
thread switch results in kernel stack switch

On x86 protected mode,task-switch results in renewal of TR(task register).

Renewal of TR contains to renew kernel stack(ss0:esp0) .

Now,suppose one process has two threads(A,B) and they have separate

register set , PC , user stack and kernel stack(ss0:esp0).

When thread-A switches to thread-B,the TR doesn't renew because they

are int the same process.

Howerer , thread-B uses call-gate or interrupt to make user's stack switch

to kernel stack(ss0:esp0),But the kernel stack belongs to

thread-A , because task-switch doesn't happen and TR keeps a state

(includeing kernel stack) of thread-A.

Thread-B uses call-gate or interrupt and it's kernel stack refers to TR

,But the kernel stack in TR belong to thread-A.

How the thread-B use own kernel stack without task-switch ?

ps: task-switch causes renewal of TR, the behavior is calles task-swich,

not "thread-switch" .

My problem is how to use own kernel stack in thread-B.

Thanks very mush!!
Old 05-17-2005, 11:48 PM   #2
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Oh dear ... it's been more than a year since my OS class in grad school and we were doing that all on SPARC, which is completely different from x86. But I know that Linux uses the 1-1 model to implemented threading in the kernel. So each thread is actually a different process, as far as the kernel is concerned (i.e. the PIDs are the same, but the TIDs are different), therefore I think that each thread has its own TSS and its own kernel stack, which makes sense as each thread needs its own instruction pointer, among other things. This page seems to have some good info, but I don't have the time to read it all right now :-(.

BTW you might want to ask a mod to move this to the programming forum, as it might get better coverage there. Not sure.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How switch from Kde to Gnome....thsi could be better thread name WannaLearnLinux Linux - Newbie 4 12-29-2005 09:11 PM
Kernel Recompile & switch distros Tarential Linux - Software 1 08-29-2004 09:47 PM
set up DSL thru SWITCH - winXp connected to SWITCH too husz Linux - Newbie 5 04-22-2004 12:08 AM
how to switch back to kernel 2.4? spade Linux - Newbie 1 03-09-2004 11:04 AM
The switch to kernel 2.6.0; any one want to share experiences qanopus Member Success Stories 8 01-02-2004 12:15 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:41 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration