What are the differences among short-term, medium term, and long-term scheduling?Answer: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.Describe the actions taken by a kernel to context-switch between processes.Answer: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.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.Answer:Including the initial parent process, how many processes are created by the program shown in Figure 3.

28?Answer: 8 processes are created. The program online includes printf() statements to better understand how many processes have been created.Using the program in Figure 3.29, identify the values of pid at lines A, B, C, and D. (Assume that the actual pids of the parent and child are 2600 and 2603, respectively.

)Answer:A = 0, B = 2603, C = 2603, D = 2600Consider the RPC mechanism. Describe the undesirable circumstances that could arise from not enforcing either the "at most once" or "exactly once" semantics. Describe possible uses for a mechanism that had neither of these guarantees.Answer:If an RPC mechanism could not support either the “at most once” or “at least once” semantics, then the RPC server cannot guarantee that a remote procedure will not be invoked multiple occurrences.

Consider if a remote procedure were withdrawing money from a bank account on a system that did not support these semantics. It is possible that a single invocation of the remote procedure might lead to multiple withdrawals on the server. For a system to support either of these semantics generally requires the server maintain some form of client state such as the timestamp described in the text. If a system were unable to support either of these semantics, then such a system could only safely provide remote procedures that do not alter data or provide time-sensitive results. Using our bank account as an example, we certainly require “at most once” or “at least once” semantics for performing a withdrawal or deposit. However, an inquiry into an account balance or otherUsing the program shown in Figure 3.

30, explain what the output will be at Line A.Answer:The output will be Parent: Value = 5. Once the child process has forked, it is no longer connected to the parent (i.e., the child will have all of the variables and values of the parent when the fork is complete, but they will no longer share memory), so the update to the variable ‘value’ does not affect the parent.