ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > ZSTU-(2020-2021)-1 > student homework > 2018529627042 Mekan Muradov >
Homework 2_2018529627042 Version 0
👤 Author: by mrdv1998gmailcom 2020-10-13 06:57:23
What is the purpose of Process? describe their relation and difference for process and program. Why the status of process is divided into five states, not other numbers, such as 4,7?



Question 1. What is the purpose of a Process?

A Process is a program in execution, which forms the basis of all computation.



In computing, a process is the instance of a computer program that is being executed by one or many threads. It contains the program code and its activity. Depending on the operating system (OS), a process may be made up of multiple threads of execution that execute instructions concurrently.

While a computer program is a passive collection of instructions, a process is the actual execution of those instructions. Several processes may be associated with the same program; for example, opening up several instances of the same program often results in more than one process being executed.

While a computer program is a passive collection of instructions, a process is the actual execution of those instructions. Several processes may be associated with the same program; for example, opening up several instances of the same program often results in more than one process being execute

Purpose:

A process is more than the program code, it includes the program counter, the process stack, and the content of the process register, etc. The purpose of the process stack is to store temporary data, such as subroutine parameters, return address and temporary variables.

It needs resources like processing, memory and I/O resources to accomplish management tasks. During the execution of a program, it could engage processor or I/O operation that makes a process different from a program.



Question 4  Describe their relation and difference for process and program.

Key Differences Between Program and Process


 

 



    1. A program is a definite group of ordered operations that are to be performed. On the other hand, an instance of a program being executed is a process.




 



    1. The nature of the program is passive as it does nothing until it gets executed whereas a process is dynamic or active in nature as it is an instance of executing program and perform the specific action.




 



    1. A program has a longer lifespan because it is stored in the memory until it is not manually deleted while a process has a shorter and limited lifespan because it gets terminated after the completion of the task.




 



    1. The resource requirement is much higher in case of a process; it could need processing, memory, I/O resources for the successful execution. In contrast, a program just requires memory for storage.




 

 

Conclusion


Program and process are relevant but are dissimilar. A program is just a scr ipt stored on disk or seem to as the previous stage of the process. On the contrary, the process is an event of a program in execution.



Question 3. Why the status of process is divided into five states, not other numbers, such as 4,7?



Five-State Process Model is an extension of the Two-State Model. The two-stage model is efficient if all the processes in the Not-running state are ready for execution but this may not be true. Some processes in the Not-running state might be waiting for some event or I/O operation. Thus, the dispatcher cannot simply select the process from the front of the queue. The dispatcher would have to scan the queue to search for the process to execute. It degrades performance.

The most common use of a new state is most OS limits the number of processes that can be in the main memory. This is because a large number of processes can lead to thrashing which results in low CPU utilization. The CPU only keeps some information about the new process in the main memory. The program is not yet loaded. The program waits for long term scheduler to move it to the main memory.

In the Ready state long term scheduler picks up a new process from second memory and loads it into the main memory when there are sufficient resources available. The process is now in ready state, waiting for its execution.

In the Running State this transition can occur when the process runs for a certain amount of time running without any interruption. For example, if we use round-robin to schedule processes, then the running process will move to the ready state after time quantum. Another example is if the priority of a process in the ready state is more than the priority of the currently running process, then OS may preempt the running process and move it to ready state.

A process moves from waiting state to ready state if the event the process has been waiting for, occurs. The process is now ready for execution.

When a process terminates, the OS frees its data. But there might be some other process that might need this data. So, the OS reserves the data temporarily. For example, when a child process finishes the execution, the OS preserves information about the child until the parent process call wait(). The child process is still consuming resources like memory but not executing.



Conclusion:

The process, from its creation to completion, passes through various states. The minimum number of states is five. A process passes through different states as it executes. These states may be different in different operating systems.

The names of the states are not standardized although the process may be in one of the following states during execution.

Please login to reply. Login

Reversion History

Loading...
No reversions found.