The virtual machine concept takes the layered approach and t
The virtual machine concept takes the layered approach and treats both the kernel of the operating system and the hardware as though they were hardware.
True
False
Discuss the tradeoffs between user and kernel threads?
a.What are the advantages and disadvantages of each?
b.Assume we can make system calls as fast as procedure calls using some new hardware mechanism. Would this make one kind of thread clearly preferable over the other? Explain briefly?
Why is the process table needed in a timesharing system? Is it also needed in personal computer systems in which only one process exists (taking over the entire machine until it is finished)?
Solution
The virtual machine takes the layered approach and it treats both the kernel and hardware as a hardware.
Hence the given statement is true.
a)
Advantages of user thread:
1) It can be implemented on operating system that does not support threads.
2) It does not modify the operating system code.
3) Thread switching is not expensive.
Disadvantages of user thread:
1) Most of the thread system calls are blocking.
2) Multiprocessing is not utilized.
Advantages of kernel thread:
1) Kernel routines can be multithreaded.
2) Blocking of one thread can not affect other threads.
Disadvantages of Kernel thread:
1) It is slower to create and manage.
2) Context switching between threads requires a mode switch to kernel. This is extra overhead as compare to user level thread.
b)
If system calls are fast as procedure calls then we should prefer kernel level thread. In that case, it overcomes the second disadvantage of kernel level threads(extra overhead). Kernet thread switching will not take too much time in that case.
Why is the process table needed in timesharing system?...
Ans: Because we need to store the metadata of the process somewhere in order to be taken off the processor. Metadata is needed when context switch between processes occurs. If there is ony one process exists, then there is no need of process table, since there is only one process hence there is no need for context switch.
