jerryschen31 / learn

Scratch repo used for learning stuff
GNU General Public License v3.0
0 stars 0 forks source link

CS basics #28

Open jerryschen31 opened 1 year ago

jerryschen31 commented 1 year ago

Compiler Runtime Caching Etc

jerryschen31 commented 1 year ago

https://www.underthehoodlearning.com/what-is-runtime-environment/#:~:text=Runtime%20environment%20takes%20its%20meaning,particular%20codebase%20in%20real%20time Runtime - The Lifecycle: The first meaning of runtime is with regards to program lifecycle. It refers to the period of time in which a program is executing in contrast to the period of time in which a program is compiled. For example, we often distinguish compile error vs. runtime error.

jerryschen31 commented 1 year ago

Runtime environment takes its meaning in the context of runtime - the lifecycle. Therefore, runtime environment is the environment in which a program or application is executed. It's the hardware and software infrastructure that supports the running of a particular codebase in real time.

jerryschen31 commented 1 year ago

We use a variety of computer programs every day, for tasks like photo editing, word processing, and calculation. It's expected that these programs run as fast and smoothly as possible under a variety of conditions. Since operating systems can differ significantly from each other, and even the same OS has many different versions, it's necessary for developers to adapt programs to each OS by using runtime environment

Advantage Conservation of resources: Allows similar applications to use the same runtime environments and share common components.

jerryschen31 commented 1 year ago

Your code is just code. Whatever you write, in whatever language you choose, needs to eventually execute on a computer. An application that's currently running interacts with the runtime environment via a runtime system. The runtime environment, therefore, acts as the middleman between the application and the operating system

jerryschen31 commented 1 year ago

As soon as a program is executed, the runtime environment sends instructions to the computer's processor and RAM, and accesses system resources. A runtime environment provides various basic functions for memory, networks, and hardware. These functions are carried out by the runtime environment instead of the application and work independently of the OS. They include reading and writing files, managing input and output devices, searching and sorting files, and transporting data via networks.

jerryschen31 commented 1 year ago

Fun fact: the individual modules of a runtime environment are saved in runtime libraries. In Windows, you can identify these libraries based on the extension .dll (dynamic link library); in Linux, they have the file suffix .so (shared object).

jerryschen31 commented 1 year ago

We can look at software as a series of layers that sit on top of the system hardware. Each layer provides services that will be used and required by the layer above it.

jerryschen31 commented 1 year ago

JavaScript is a high-level language whose high-level runtime environment is Node.js. Node comes with fancy features like a callback queue, and event loop, and a thread pool

jerryschen31 commented 1 year ago

we can say that the universal runtime environment for any kind of programmatic execution is the operating system. The OS is the only way you can get the CPU to execute your code. The OS ensures that your program gets sufficient memory, gets scheduled fairly, and doesn't disturbed its neighbors