In: Computer Science
When does the operating system assign/allocate resources (i.e. memory) to a process?
a) When the process starts
b) While the process is running
c) When the process is terminated
d) Both a and b
e) a, b and c
Also please give resources so I can look into more in-depth
The answer for the above question is d. That is both a and b.
The operating system will assign or allocate the resources (i.e. memory) to a process
-->When the process starts and
-->While the process is running
The reason that i choose those options is, if we observe the banker's algorithm, there we see that the processes are allocated with some resources initially and some of the resources that are required the process will allocates while the process is running. And also if we the 5 state and 7 state diagrams of processes life cycle, there also we can see that, the process will execute for some extent with few resources given initially and back to waiting state if they needed any resources other than already allocated. After getting these resources the process will again go to running state.
Here the answer is not When the process is terminated becuase the termination of process means process is already executed i.e. it has completed it's execution. So no resource is needed to the already completed processes as they will not go to running state again.
The resources that should be followed to understand the above concept is:
we should have the grip on the topics of Banker's algorithm and Diagrams of the life cycle of the process.
Hope the above is helpful. Please feel free to comment if any queries in the
comment section. I will try to solve them as soon as possible.
Do an up vote. Thank you...