Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What are the benefits of implementing an application as a multi-threaded process

ID: 3563886 • Letter: W

Question

  1. What are the benefits of implementing an application as a multi-threaded process in a) multiprocessor b) uniprocessor environments?
  2. What is the benefit of scheduling all threads of a process together on multiple processors at a time versus scheduling threads (from different processes) one at a time as individual processors become available?
  3. If you have to choose between user level threads and kernel level threads, under which conditions you would prefer one over the other?
  4. What are the various possibilities when one thread requests that another thread be cancelled?
  5. How can one create a user level thread or kernel level thread using pthread_create?

Explanation / Answer

1)

Benefits of Using the Thread Pool

The runtime-managed thread pool is the easiest and most reliable approach to implement multithreaded applications. The thread pool offers the following benefits:

The following procedure describes how to use the thread pool to perform a background task in a separate thread.

To use the thread pool to perform a background task

In the following code, the AuthorizePayment method is executed in a thread allocated from the thread pool.

3)

The term "kernel threads" can be used to refer to actual threads that run entirely in kernel space or it can refer to user-space threads scheduled by the kernel. The term "kernel-supported" threads means the latter, threads that run in user-space but are facilitated by the kernel, which usually means the kernel schedules them.

"User-level threads" usually means threads visible to user space. That is, what you create when you call your threading standard's "create thread" function. Generally, the term "user-level thread" is used to mean a thread created by the application code regardless of how it's implemented by the system. It may be a pure user-space thread with little to no kernel support or it may be a thread scheduled by the kernel.

The pthreads standard can be implemented as pure user-space threads (where the kernel schedules the process and the process schedules the threads), kernel-supported threads (where the kernel schedules the threads directly), or a hybrid approach (where the kernel schedules a kernel-level thread which then, in user-space, schedules a user-level thread). The standard doesn't demand any one particular means of implementation. The most common implementation is 1-to-1 mapping where each user-level thread has a corresponding thread that is scheduled by the kernel.

4)

Thread cancellation and resource leaks

In a multi-threaded C program where threads share address space and may be operating on shared objects as long as they use the proper synchronization tools, it

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote