The software we have been talking about till now are system–level programs. Though apps are not the focus of this article, it’s time we talk about the wheels of the smartphone revolution- app!
The word ‘application; means to put something in operation. Application programs are software designed to put the hardware into operation for a task. We have already discussed that operating system are designed to make sure that certain actions are privileged and to perform those operations, the OS expose APIs (Application Programming Interface).
An application is normally compiled for a certain OS and architecture so that it can use the capabilities for the target OS and run the code on the target microprocessor. When the application launched, the OS reads the application file, loads executable code in memory and asks the processor to start executing the loaded executable with the lowest privilege levels. As the application executes, it calls APIs provided by the OS for its need (like reading a file from disk, sending data over network.etc ).
The application is written in cross-platform languages (like Java, C#, Python, etc.) are not binary programs that can run directly on the hardware, Instead, they need the language runtime environment to be present on the OS which interprets the program and runs it. The execute for such a program happen in this manner:-
- When the application is launched, the OS reads the files and determines that the program needs a language runtime to execute. The OS determines this either by reading the file extension or the first few bytes of the file.
- The OS launches the language environment like any other application and supplies it the original program file it read in step 1. If the runtime is not present, it can show an error or open the file in an editor program.
- The runtime reads the file. Depending on the runtime. It would first interpret the file and generate code (standing for operation code and sometimes called bytecode.) Languages like Java or .NET expect the input to be in bytecode formate.
- Runtime reads the byte-code and converts it to binary codes which can run on the platform’s microprocessor. For performing the operation which needs support from OS (like reading a file or transmitting data over the network), the runtime translates the bytecode instructions runtimes stopes itself and exits.
- Once all execution has been done, the language runtime stops itself and exits, In these cases, the language’s runtime must be designed for the platform (Processor architecture and OS).