You are on page 1of 3

Chapter 4

1. What is the difference between multiprogramming and timesharing in terms of job execution? What is the reason of implementing the multiprogramming and timesharing? Both multiprogramming and time-sharing are used to increase the CPU utilization. A subset of jobs is kept in the main memory. In the case of multiprogramming, a job will be selected by the scheduler and executed by the CPU. The CPU will switch to another job only when the current job has to wait, for example, I/O devices. In the case of time-sharing, the CPU will continue to switch from one job to another. Each job is allocated with a specific time slice. The CPU will switch to another job when the time slice expired. 2.

When the CPU switches from Process 1 to Process 2, the CPU performs a contextswitch that saves the state of the Process 1, and loads the saved state of Process 2. Then, the CPU will continue to execute Process 2, until it has to switch to Process 3. In this case, the CPU performs another context-switch that saves the state of the Process 2, and loads the saved state of Process 3. 3. Describe the operation and purpose of swapping. It is used to remove processes from the main memory, and thus reduce the degree of multiprogramming.

When the main memory is fully occupied, the process will be swapped out from the main memory. This process can be reintroduced into the main memory later to continue the execution from where it left off.

4. Describe the characteristics of short-term, medium-term and long-term scheduling. Short-term Scheduler Select which process should be executed next and allocates CPU. It must select a new process for the CPU frequently.

Long-term Scheduler Select which process should be brought into the ready queue. Execute much less frequent than the short-term scheduler. Can take more time to select the process for execution.

Medium-Term Scheduler Swap in-active process out from the main memory. This process can be reintroduced back into the memory later. Can be used to reduce the degree of multiprogramming. Determine which process to swap-in and swap-out. The maximum number of processes that a single-processor system can accommodate efficiently. The primary factor affecting this is the amount of memory available to be allocated to executing processes. If the amount of memory is too limited, the degree of multiprogramming will be limited, because only fewer processes can fit into memory. But if the degree of multiprogramming is too high, thrashing might occur and causes degradation in performance. 6. If a synchronous type of communication is required, what is the requirement that should be imposed on the sender and the receiver in the message-passing model? Blocking send and blocking receive. The sender is blocked until the message is received by the receiving process or by the mailbox and the receiver is blocked until a message is available.

5. Describe the degree of multiprogramming.

7. Explain how the size of a message (fixed/ variable) could affect the system implementation and programmer. If the size of a message is always fixed, it is easier for system implementation, but harder for programmer, because the programmer will have to explicitly divide a long message into several chunks of smaller message determined by the fixed size. If a message can be in variable size, it is harder for system implementation but easier for programmer. In this case, system will need to divide a long message into several chunks of smaller message before it can be placed into a packet.

You might also like