How does stack work in a CPU? Why do we need it?

Поділитися
Вставка
  • Опубліковано 3 січ 2025

КОМЕНТАРІ • 18

  • @thegt
    @thegt Рік тому +3

    One of the best explanations I've seen so far. Enough level of detalization, good level of visualization.

  • @darkmadarauchiha
    @darkmadarauchiha 10 місяців тому

    Really useful video, watched a few others but they didn't help much. You started at the right level to help everything else fall into place!
    Keep it up!

  • @egotraumatic
    @egotraumatic 9 місяців тому +2

    Better to watch on x1.5. Great video! Thank you!

  • @muhammedazoz
    @muhammedazoz 2 місяці тому

    Awesome explanation 🔝

  • @joerit633
    @joerit633 2 роки тому +1

    Excellent video!! Very interesting and informative!! Thank you!!!!

  • @mikhailmikheev8043
    @mikhailmikheev8043 2 роки тому +5

    youtube algorithm doing wonders

  • @abhijitbaruah2207
    @abhijitbaruah2207 4 місяці тому

    one of the best video

  • @TON-vz3pe
    @TON-vz3pe Рік тому

    Fantastic explanation. But where does the text segment fits in all this?

    • @0x20d
      @0x20d 10 місяців тому

      I assume you mean the text segment in your assembly file?
      If so, the text segment holds your instructions.
      In case of this example that would be j=j+k
      (or EAX

    • @user-hk4cu5go9c
      @user-hk4cu5go9c 4 місяці тому

      The text segment is a memory segment of a process which contains the instructions of that process. Thus, the IP points to instructions in the text segment which, when pointing to functions being called, invokes function stack frames to be created on the stack (and hence the increment/decrement of the stack pointer). Hope that makes sense, assuming I've understood your question correctly lol.

  • @Akanoa-bzh
    @Akanoa-bzh 2 роки тому +1

    Great explanations thanks :)

  • @aeleee
    @aeleee 3 місяці тому

    best ever

  • @krenilraj4180
    @krenilraj4180 Рік тому +1

    can someone explain me , the foo() function in the white diagram is the instruction there and foo stack frame , a stack is created for foo function inside there variables are stored and after it is successfully loaded it will CPU will start executing foo function
    Am I right ?
    If wrong please explain me

    • @user-hk4cu5go9c
      @user-hk4cu5go9c 4 місяці тому

      Yes, you are correct. Once the foo() function has finished executing on the CPU, the stack pointer is incremented to a higher memory address back to the top of main's stack frame and foo's stack frame is popped off.
      Remember, the stack pointer gets INCREMENTED because the stack grows downards towards lower memory addresses, hence any stack frames being popped cause the pointer to point to the previous stack frame's HIGHER memory address.

  • @Jkauppa
    @Jkauppa 2 роки тому

    why not just direct in-memory computing

  • @tsunningwah3471
    @tsunningwah3471 11 місяців тому

    zhina!!!!!

  • @yuriyfse6555
    @yuriyfse6555 Рік тому

    ma-an, very slowly it's 2023 on yard, not 1960 - in youtube we can watch many different videos