1.Describe the steps executed by a kernel to context-switch between processes. [
ID: 641500 • Letter: 1
Question
1.Describe the steps executed by a kernel to context-switch between processes. [3 pts]
2.Can you provide a programming example in which multithreading does not provide better performance than a single-threaded solution? Justify your answer. [3 pts]
3.Compare and contrast two major variations of message passing systems. [3 pts]
4.Suppose you have a multiprocessor system with 4 equal capability processors. A special-purpose OS is installed in the system. The OS supports multi-threading by providing up to 4 kernel threads per application program and uses many-to-many model to map user threads to kernel threads. The system is currently running only one process. The program is multithreaded and works on square arrays of size at least 3
Explanation / Answer
1. When a transition between user mode and kernel mode is required in an operating system, a context switch is not necessary; a mode transition is not by itself a context switch. However, depending on the operating system, a context switch may also take place at this time.
Major Steps of Context Switching
In a multiprogrammed uniprocessor computing system, context switches occur frequently enough that all processes appear to be running concurrently. If a process has more than one thread, the Operating System can use the context switching technique to schedule the threads so they appear to execute in parallel. This is the case if threads are implemented at the kernel level. Threads can also be implemented entirely at the user level in run-time libraries. Since in this case no thread scheduling is provided by the Operating System, it is the responsibility of the programmer to yield the CPU frequently enough in each thread so all threads in the process can make progress
Context switches among processes are expensive. Before a process can be switched its process control block (PCB) must be saved by the operating system. The PCB consists of the following information:
When the PCB of the currently executing process is saved the operating system loads the PCB of the next process that has to be run on CPU. This is a heavy task and it takes a lot of time.
2.
Any kind of sequential program is not a good candidate to be threaded. An example of this is a program that calculates an individual tax return. (2) Another example is a
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.