Question

In: Computer Science

1.What are two differences between user-level threads and kernel-level threads? Under what circumstances is one type...

1.What are two differences between user-level threads and kernel-level threads? Under what circumstances is one type better than the other?

2.Describe the actions taken by a kernel to context switch between kernel level threads.

3.What resources are used when a thread is created? How do they differ from those used when a process is created?

4.Provide two programming examples in which multithreading provides better performance than a single-threaded solution.   

5.Assume an operating system maps user-level threads to the kernel using the many-to-many model and the mapping is done through LWPs. Furthermore, the system allows developers to create real-time threads. Is it necessary to bind a real-time thread to an LWP? Explain

6.Windows Vista provides a lightweight synchronization tool called slim reader–writer locks. Whereas most implementations of reader–writer locks favor either readers or writers, or perhaps order waiting threads using a FIFO policy, slim reader–writer locks favor neither readers nor writers, nor are waiting threads ordered in a FIFO queue. Explain the benefits of providing such a synchronization tool.

Solutions

Expert Solution

1) User Level Thread   Kernel Level Thread

(a) ULT are managed by user level libraries (a) KLT are managed by operating system ie kernel ( through system calls)

(b)Implementation is easy (b) its implementation is complex

(c) context switching is faster (c) context switching is slower

ULT is better as no H/w support is required whereas KLT requires H/w support

ULT is faster than KLT  

KLT is better as in KLT if 1 thread is blocked ,it wont affect on other whereas in ULT if one thread is blocked entire process is blocked..

ULT thread is dependent thread as it depends on APIs libraries but KLT is Independent thread as every decision is taken by os itself

2) Actions taken by kernel to context switch between kernel threads : as mentioned before context switching is slower with respect to kernel thread as Kernel maintains context information for the process as a whole and for individual threads within process during context switching between kernel threads.

3)The resources used to create a thread are threadID,stack, set of register ,basically thread creation requires fewer resources as compared to process creation so thread creation is a light weight task.

process creation requires Process control block allocations which is larger than any database also memory allocation to program instruction and data is done which is time consuming yet heavy weight task of process creation with more resources.

4) two programming examples in which multithreading provides better performance than a single threaded solution are

a) Web servers - they basically serves web content or applications to clients who request for a service.

web servers performance will be better using multiithreads as multiple client request can be tackled by multiple threads whereas using single threaded solution will affect the performance as every time a new thread needs to be created to serve every new service requested by client..

b) Remote Procedural Callsystems which is also called as subroutine call or functional call - its client server mechanism model where a client makes a request to a server and server provides the results or the message

suppose single thread solution is used in RPC then for every client request thread will be suspended until the result is fetched by the server this makes it time consuming

but using multithread solution will increase the time efficiency of client server model by running several threads concurrently where other threads will provide messages to the client thus suspending of threads won't affect its performance.


Related Solutions

In what ways are user-level threads better/more efficient than kernel-level threads? In what ways are they...
In what ways are user-level threads better/more efficient than kernel-level threads? In what ways are they less efficient?
Threads: Assume a multithreaded application using user level threads mapped to a single kernel level thread...
Threads: Assume a multithreaded application using user level threads mapped to a single kernel level thread in one process (Many to one model). Describe the details of what happens when a thread (i.e. thread 1) executes a blocking system call (5 points). Describe what happens when thread 1 yields control to another user level thread, namely thread 2, in the same process. (NOTE: include the following in your description: what state is saved?, where is it saved? What state is...
Which of the methods used to map user threads to kernel threads can exploit a multiprocessor...
Which of the methods used to map user threads to kernel threads can exploit a multiprocessor environment? Justify your answer
Which of the methods used to map user threads to kernel threads can exploit a multiprocessor...
Which of the methods used to map user threads to kernel threads can exploit a multiprocessor environment? Justify your answer.
Name one advantage of associating user threads with kernel thread? Suggest an advantage and disadvantage of...
Name one advantage of associating user threads with kernel thread? Suggest an advantage and disadvantage of using mailboxes over shared memory for inter-process communication.
Under what circumstances can a man with type B blood and a woman with type a...
Under what circumstances can a man with type B blood and a woman with type a blood have a child with type O blood? Under what circumstances is that not possible?
Explain the differences and similarities between parametric and non-parametric inferential statistics. When (under what circumstances) would...
Explain the differences and similarities between parametric and non-parametric inferential statistics. When (under what circumstances) would a parametric statistic be your preferred statistic? When would a non-parametric statistic be your preferred statistic?
Under what circumstances is it appropriate to run a one-tailed, as compared to a two-tailed Student’s...
Under what circumstances is it appropriate to run a one-tailed, as compared to a two-tailed Student’s T-test? Under what circumstances is it appropriate to run a Paired T-test, as opposed to a Student’s T Test? Under what circumstances is a one-sample T-test the correct one to run?
1. Why there needs to be user thread and kernel thread? 2. What are the advantages...
1. Why there needs to be user thread and kernel thread? 2. What are the advantages and disadvantages of writing an operating system in a highlevel language, such as C? 3. What is a critical section problem? Demonstrate that with an example. 4. With an example, show how critical section can led to dead locks. 5. Write two differences between a network OS and a distributed OS. 6. Identify the following environments as hard, firm or soft real time. Give...
Under what circumstances would there be a “no-arbitrage” situation in goods markets between two nations? Answer:when...
Under what circumstances would there be a “no-arbitrage” situation in goods markets between two nations? Answer:when the relative price of the currencies is equal to one Which formula we use to state it?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT