Andy Melnikov (nponeccop) wrote,
Andy Melnikov
nponeccop

К вопросу о неадекватности Си как низкоуровневого языка

Стек вызовов в Си является волшебной структурой данных, на которую автор программы никак не может влиять (например, нельзя оптимизировать оверхед стек-фреймов, делать stack unwinding, продолжения и т.п.)

The modern operating systems we have (Windows, Linux) operate with what I call the "big stack model". And that model is wrong, sometimes, and motivates the need for "stackless" languages.

The "big stack model" assumes that a compiled program will allocate "stack frames" for function calls in a contiguous region of memory, using machine instructions to adjust registers containing the stack pointer (and optional stack frame pointer) very rapidly. This leads to fast function call/return, at the price of having a large, contiguous region for the stack. Because 99.99% of all programs run under these modern OSes work well with the big stack model, the compilers, loaders, and even the OS "know" about this stack area.
Subscribe

  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 55 comments