Chapter 3: Processes Flashcards
What is a process?
The unit of work in a modern time-sharing system
List and define the 5 states
New - The process is being created.
Running - Instructions are being executed.
Waiting - The process is waiting for some event to occur (such as an I/O completion or reception of a signal).
Ready - The process is waiting to be assigned to a processor.
Terminated - The process has finished execution.
What state(s) can a process transition to from running?
waiting
blocked/ready
blocked/suspended
terminated
When a process is swapped out or suspended in secondary memory, what state does it have to transition to in order to be scheduled?
Ready/suspended
What three state(s) can process transition to ready?
suspended
waiting
running
In the UNIX state diagram, there is a user running state and a kernel running state. Why is this?
for dual mode, processes to run simultaneously.
What scheduler determines which process will be run by the CPU?
Short term scheduler
Describe long and short term scheduling
Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue. Is invoked very infrequently and can be slow. (seconds, minutes) Controls the degree of multiprogramming.
Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU.
Is invoked very frequently (milliseconds). Has to be fast.
What’s the difference between I/O and CPU bound processes?
I/O spends more time doing I/O than computations. Has many short CPU bursts.
CPU spends more time doing computations. Has few very long CPU bursts.
What happens to processes that are running and then request an I/O?
The processes are placed in an I/O queue.
Why are processes put in a swapped/ready state?
Because theres too much contention so it must wait.
What are some possible reasons that cause a process to give up the CPU or become blocked and eventually be moved to the ready queue?
Interrupts
What’s the importance of degree of multiprogramming?
It has make a careful selection and select a good process mix. I/O and CPU bound processes .
If all processes are I/O bound, the ready queue will almost always be empty, and the short-term scheduler will have little to do.
If all processes are CPU bound, the I/O waiting queue will almost always be empty, devices will go unused, and again the system will be unbalanced.
What operating systems don’t have long-term schedulers?
Unix and microsoft windows
What’s the idea behind medium-term scheduler?
To remove processes from memory and reduce the degree of multiprogramming and to possible add processes back into memory later using the swapping method. The key advantage of doing this is to improve the process mix or to free up memory.
Describe Context Switching
When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process.
Context-switch time is overhead; the system does no useful work while switching.
Time dependent on hardware support.