Execution in Computers

There are two types of memory in the computer system you need to know about to understand how the application software is installed and how to execute/run them.

The Central Processing Unit (CPU) has access only to the main memory from which it can read the software which needs to be executed. All the application softwares which are installed on the computer system are stored in the Secondary memory.

Main Memory

This memory is referred to as Random Access Memory (RAM). It stores data electronically using the transistors as switches with their ON and OFF states representing the 1 and 0 respectively.

Characteristics of Main memory: -

  • Speed: RAM is the fastest memory in a computer, and its speed affects how quickly the computer loads and how it runs.
  • Volatility: RAM is volatile, meaning stored data is lost when the computer is turned off or reset.
  • Cost: RAM is more expensive than a hard drive because it's made of semiconductors, which are more expensive than the magnetic tapes used in hard drives.
  • Usage: RAM is used as temporary storage for programs and data that are currently in use, such as when loading applications and software.

Secondary Memory

Characteristics of Secondary memory: -

  • Non-volatile: Data stored in secondary memory is permanent, even when the computer is turned off.
  • Capacity: Secondary memory devices can store large amounts of data and programs.
  • Cost-effective: Secondary memory is usually less expensive than primary memory.
  • Portable: Many secondary memory devices can be moved around, making it easy to transfer data between devices.
  • Removable or fixed: Secondary memory can be either fixed or removable, depending on the need.
  • Slower speed: Secondary memory is not as fast as primary memory.
  • Indirect access: The computer processor doesn't have direct access to secondary memory.

The flow of applications being executed in the Computer System

  1. Loading Process Initiation: The loading process begins when the user or the operating system initiates the execution of the application. This could be through clicking an icon, running a command, or some other form of user interaction.

  2. File System Access: The operating system locates the executable file of the application on the secondary storage device (e.g., hard drive). This file contains the compiled code and resources needed to run the application.

  3. Memory Allocation: The operating system allocates a portion of the main memory (RAM) to accommodate the application. This allocation depends on the size of the application and the availability of free memory.

  4. Loading into Memory: The executable file of the application is loaded from secondary storage into the allocated space in the main memory (RAM). This process involves: 1. Reading the executable file from the storage device into RAM. 2. Resolving memory addresses and references within the executable file to ensure proper execution. 3. Mapping any required dynamic libraries or shared resources into memory as well.

  5. Initialization: Once the application code and necessary resources are loaded into memory, initialization routines are executed. These routines prepare the application environment, set up initial variables, and perform any necessary setup tasks before the application starts running.

  6. Execution: Finally, the application starts executing its main program logic. It interacts with the user or performs its intended tasks based on the instructions provided in the executable code.

  7. Memory Management: Throughout the application’s execution, the operating system manages memory, ensuring that resources are efficiently utilized. This includes handling memory allocation, deallocation, and swapping data between main memory and secondary storage as needed to optimize performance.

  8. Termination and Cleanup: When the application is closed or terminated, the operating system deallocates the memory space that was allocated for the application, releasing resources back for other applications or system processes.