I have a question about the process state diagram in the operating system.

Asked 2 years ago, Updated 2 years ago, 88 views

If you look at the process state diagram, there are states such as new, ready, running, waiting, etc.

At this time, the process does not go to ready immediately when there is an input/output or event, but waitsng and then goes to ready state.

The question here is not going from running state to ready state, but from waiting state to cpu utilization

I heard that you can increase the utilization rate of cpu by what?

operating-system

2022-09-22 14:29

2 Answers

The Ready state is waiting to be assigned to the CPU by the OS scheduler and Waiting is waiting for some event to occur, such as IO completion.

Assuming that a process waiting for IO completion is in the Ready state, if that process is scheduled, CPU utilization will decrease because the CPU will perform operations and play while waiting for the unfinished IO completion, right?

For this reason, when you have to wait for a particular event, you go to the Waiting state, not Ready.

(If you think your answer is wrong or you need supplementary content, please leave a comment.)

))


2022-09-22 14:29

I didn't understand the intention of the question well, so I explained it first.

Going from Running state to Waiting can be seen as a state of accessing certain resources, such as I/O, making a request for that resource, and then waiting for a response.

Going from Running state to Ready is when the scheduler writes maximum CPU and then forces the transfer to another process.

If you look at it according to the perspective, it is as follows.

Entrance a specific process

When other processes go to Waiting, the probability that they can use the CPU exclusively increases, so CPU usage is bound to increase.

Enter the operating system

Assuming that all processes have a uniform execution opportunity and that the CPU utilization that the operating system intervenes to use is zero, the CPU utilization would be:

So it's no different than one process being monopolized or multiple processes being shared.

Here, changing the state of the process and scheduling results in context switching, which is not zero (ignoring other costs of the operating system in this discussion), CPU utilization is as follows:

From here, context switching costs as much as it costs, and processes fail to use the CPU. Context switching is what happens between processes in the Ready state <-> Running state and the more processes in the Ready state, the more frequently they occur, which increases the overall loss.

Conversely, if processes transition to the Waiting state rather than Ready, the overall context switching cost will decrease, which will increase the CPU utilization that the actual processes use.

In summary, the higher the overall cost of context switching, the lower the utilization of the processes, which is certainly advantageous for fewer Ready state processes. Conversely, the lower the overall cost of context switching, the less the number of Ready state processes is affected.

I don't know if it was answered.


2022-09-22 14:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.