3.6 What are the differences among short-term, medium term, and long-term scheduling?
The short-term scheduler selects from the ready processes the next process to run and gives it the CPU. The long-term scheduler selects from the pool of processes that are waiting on disk and loads the selected processes into memory. These processes have not yet begun their execution. The medium-term scheduler takes processes that are currently in memory and selects those to be swapped out to disk. These processes will be swapped back in at a later point. This is done to improve process mix or because of memory requirements like overcommitted and needs to free up memory.
A primary difference is in the frequency of their execution. The short-term scheduler must select a new process quite often. Long-term is used much less often since it handles placing jobs in the system and may wait a while for a job to finish before it admits another one.
3.7. Describe the actions taken by a kernel to context-switch between processes.
The kernel saves the state of the currently executing process into its Process Control Block (PCB ). The state includes the values of all registers, process ID, memory information, list of open files, and so forth. It then reloads the context of a previously suspended process and sets the instruction counter to the restored processes next instruction.
3.8 Construct a process tree similar to Figure 3.9. To obtain process information for the UNIX or Linux system, use the command ps -ael. Use the command man ps to get more information about the ps command. On Windows systems, you will have to use the task manager.
3.9 Including the initial parent process, how many processes are created by the program shown in Figure 3.28?
8 processes are created. The program online includes printf() statements to better understand how many processes have been created.
Please join StudyMode to read the full document