Multistep Processing of a User Program Last Updated : 21 May, 2024 Comments Improve Suggest changes Like Article Like Report Program is a sequence of instructions written by the user that instructs the computer to perform the task of solving some problem. We will now learn more about the various steps a program goes through before it gets executed. The program resides on the disk as a binary executable file. In order to run the program, it must be brought from the disk into the main memory (as the only storage locations which can be directly accessed by the CPU are - Main Memory and Registers - while the register is accessed in one CPU cycle or less, the Main Memory can take many cycles). Now, let us know the detailed steps that the program goes through so that the former task is accomplished. As the program to be executed is brought from the disk to the main memory, it is placed within the context of a process, (which is basically a program under execution) where it becomes available for execution on the CPU. During the execution, it accesses data and instructions from the memory and once the execution is completed, the process is terminated and the memory is reclaimed for use by another process. The addresses in the source code are generally symbolic (like the variable count). The compiler binds these addresses to relocatable addresses and these are bonded by the linker or loader to the absolute addresses (Binding - mapping from one address space to another). The binding of instructions and data to the memory addresses can be done at any of the following steps of program execution: Compile Time: If we initially know where the process is residing in the memory at the time of compilation, then absolute code can be generated. If the starting location changes, then the code has to be recompiled. Load Time: If the memory address where the process resides is not known at the compile time, then the compiler must generate relocatable code (does not have a static memory address for running). If the starting address changes, then the program must be reloaded to incorporate this value. Execution Time: If the process can be moved from one segment to another during its execution time, then binding must be delayed till execution time. Special hardware is required for this type of binding (discussed below). Figure - Multistep Processing of a User Program Logical vs Physical Address : Logical Address is the address generated by the CPU whereas Physical Address is the one seen by the memory unit (that is the address loaded into memory-address register of the memory). The user program deals with the logical addresses and one never sees the physical addresses. Binding addresses at compile time or load time (as discussed above) generate identical logical and physical addresses whereas this is not the case when binding addresses are done at execution time. In the latter case, the physical and logical addresses generated are different. The logical address is referred to as virtual address in this case. At the run time, a hardware device called Memory Management Unit (MMU) does the mapping from virtual address to physical address. Dynamic Loading is used for more efficient memory utilization. The advantage of Dynamic Loading is that a particular routine is loaded only when it is required. Dynamically Linked Libraries (DLLs) are the system libraries that are linked to the program when the programs are run. This is the overall brief summary of the multistep processing of a user program, right from the source code stage till the execution. The attached diagram depicts the multistep processing of the program precisely. Comment More infoAdvertise with us Next Article Multistep Processing of a User Program E eshwitha_reddy Follow Improve Article Tags : Operating Systems Operating Systems-Memory Management Similar Reads Formation Of Process from Program A process is a program in execution. It is an active entity that requires system resources such as CPU time, memory, and I/O devices to execute. A program resides in secondary memory (like a hard disk or SSD). For a program to become a process it must go through various actions such as loading the p 5 min read What is SMP (Symmetric Multi-Processing)? Multiprocessing(MP), involves computer hardware and software architecture where there are multiple(two or more) processing units executing programs for the single operating(computer) system. SMP i.e. symmetric multiprocessing, refers to the computer architecture where multiple identical processors a 2 min read Multi Processing Operating System The operating system functions like a manager of all the available resources. Therefore operating system is defined as an interface between the system and the user. There are various types of operating systems such as Batch Operating Systems, Multi-programming Operating Systems, distributed operatin 4 min read Multi-User Operating System An operating system is software that acts as an interface between the user and the computer hardware which does multiple functions such as memory management; file management and processor management. The operating system should have to meet the requirements of all its users in a balanced way so that 5 min read Difference between Program and Process In Computer Science, there are two fundamental terms in operating system: Program and Process. Program is a set of instructions written to perform a task, stored in memory. A process is the active execution of a program, using system resources like CPU and memory. In other words, a program is static 4 min read Like