Re: linux switch_to function

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

 



On Mon, Mar 16, 2009 at 3:54 PM, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote:
> On Mon, Mar 16, 2009 at 2:20 PM, Mulyadi Santosa
> <mulyadi.santosa@xxxxxxxxx> wrote:
>> On Sat, Mar 14, 2009 at 5:35 PM, Gaurav Tewari <gaurav6969@xxxxxxxxx> wrote:
>>> Hi all,
>>> linux switch_to function which actually does the context switch, very
>>> smartly preserves the 'last' field of prev task_struct across context switch
>>> (the third argument of switch_to()), but where and how does it uses that
>>> argument...or saved value...
>>
>> Understanding The Linux Kernel 3rd edition completely describe it in
>> the "process switching" section. It has something to do with stack
>> juggling.... IIRC it does so, for example when process A goes to B,
>> and when B want to goes back A, the pointer is already saved
>>
>> That's all I could recall this moment...CMIIW people
>
> Is it because we manipulate the stack to save the instruction of the
> next process at the old eip (returning address), so that when the
> stack unwinds it will try to execute the return address and since we
> have the instruction on next process there we switch tasks

That could be the reason. This is also the part that I don't fully
understand since the early day I learnt about Linux kernel.

regards,

Mulyadi.

--
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