Question

In: Computer Science

Q1: Server Design Models: (explain clearly) a. For a multi-threaded server, describe the advantages of adopting...

Q1: Server Design Models: (explain clearly) a. For a multi-threaded server, describe the advantages of adopting the many-to-one threading model. b. For a multi-threaded server, describe the advantages of adopting the one-to-one threading model.

Solutions

Expert Solution

Multithreading Models

Some operating system provide a combined user level thread and Kernel level thread facility. Solaris is a good example of this combined approach. In a combined system, multiple threads within the same application can run in parallel on multiple processors and a blocking system call need not block the entire process. Multithreading models are three types

  • Many to many relationship.(One user thread mapped to one kernel level thread)
  • Many to one relationship.(Many User level threads mapped to one kernel level thread)
  • One to one relationship.(One user thread mapped to one kernel level thread)

a.

Many to One Model

  • In the many to one model, many user-level threads are all mapped onto a single kernel thread.
  • Thread management is handled by the thread library in user space, which is efficient in nature.

In the many-to-one model, you get concurrency (the appearance that tasks run at the same time).If the user level thread libraries are implemented in the operating system in such a way that system does not support them then Kernel threads use the many to one relationship modes.

The main problem with one-to-one model is that it places a restriction on you to be careful and frugal with threads, as each additional thread adds more "weight" to the process. Also it requires each thread to have its own kernel mode stack.

So using many-to-one threading model is benificial.

b.

One to One Model

  • The one to one model creates a separate kernel thread to handle each and every user thread.
  • Most implementations of this model place a limit on how many threads can be created.

In the many-to-one model, you get concurrency (the appearance that tasks run at the same time) but you can't get parallelism. There is only one kernel thread and that can't be spread over multiple processors.

In the one-to-one model, each user thread has a corresponding kernel thread, which gives the kernel more options to provide concurrency or even parallelism.

"one-to-one model," each thread really creates two threads: A kernel mode thread and a user mode thread. In reality, all that is needed a single thread that can operate in both user and kernel modes (i.e., a kernel mode stack).

The advantage a thread that can operate in both kernel and user mode (an possibly other modes as well, aka one-to-one model) is that the threads can operate completely independently and is likely simpler to implement. Each thread can enter kernel mode (e.g. perform I/O) without blocking any other thread.

The downside to many-to-many and many-to-one is that kernel mode becomes a resource whose unavailability can cause one group of threads to block another group of threads.

Let's say you have 3 kernel mode "threads" and 10 user mode threads. If 4 user mode threads try to do I/O at the same time, the 4th thread will block until one of the first three threads complete.

It is also more complicated to implement because you would have to manage the kernel mode "threads" as resources.

So it is better to use one-to-one model.


Related Solutions

write a skeleton Python TCP servers as follows: Multi-threaded concurrent TCP server using Python’s low-level socket...
write a skeleton Python TCP servers as follows: Multi-threaded concurrent TCP server using Python’s low-level socket module and Python’s threading library Python sockets API: s = socket(), s.bind(), s.listen(), remote_socket, remote_addr = s.accept() Python threading API: thread = threading.Thread(target, args, daemon), thread.start()
Explain the difference between concurrency and parallelism. Using these concepts, discuss how a multi-threaded application can...
Explain the difference between concurrency and parallelism. Using these concepts, discuss how a multi-threaded application can run faster than a single-threaded application on a single-processor machine and on a multi-processor machine.
Q1/ Multi Choices (25 Degrees) 1-one of the Advantages of Maintenance in power plant . A....
Q1/ Multi Choices (25 Degrees) 1-one of the Advantages of Maintenance in power plant . A. Greater safety for workers. B. To increase efficiency C. To increase repair cost D. To increase power 2- Used to conduct hot gas (flame) from one Combustion chamber to the next A. Flow Sleeves B. Support Clamp C. Flame Detector D. Cross Fire Tubes 3- Used to provide seal between transition piece and first stage nozzle A. liner B. Floating Seals C. Flame Detector...
Q1) Discuss the top-down and the bottom-up digital design methodologies? Q2) Explain the advantages and disadvantages...
Q1) Discuss the top-down and the bottom-up digital design methodologies? Q2) Explain the advantages and disadvantages of FPGAs compared to ASICs? Q3) Explain the benefits of hierarchical design methodology in Verilog HDL? Q4) Discuss the tradeoffs between PLDs and FPGAs devices? Q5) Discuss the advantages and disadvantages of HDL modeling using built-in primitives and User Defined Primitives (UDPs)? Q6) Discuss the tradeoffs between schematic-based design and HDL-based design? Q7) Discuss the tradeoffs between PLDs and ASIC devices? Q8) Discuss the...
a) Explain the advantages and disadvantages of exchange rate targeting. b) Supposing that Malaysia is adopting...
a) Explain the advantages and disadvantages of exchange rate targeting. b) Supposing that Malaysia is adopting the fixed exchange rate system. By assuming that the Purchasing Power Parity holds, and based on IS-LM and AD-AS diagrams, explain what would happen to relative prices if the government increases or decreases its expenditure. c) Differentiate between a fixed and flexible exchange rate. d) Despite the disadvantages, why is fixed exchange rate preferred?
Provide the goal of the study, clearly stating the research hypothesis. Describe the study design. Describe...
Provide the goal of the study, clearly stating the research hypothesis. Describe the study design. Describe the results noting the direction (e.g., higher or lower; increase or decrease; etc.) and difference between sample mean (M = ?; 95% CI = ?) and the population mean (µ = ?). Report the inferential statistic used to compute the p-value (Z [ n = ?] = observed value, p < or > .05) and state if the results are significant or not. Report...
State two (2) exchange rate regimes and briefly explain the advantages of adopting the stated exchange...
State two (2) exchange rate regimes and briefly explain the advantages of adopting the stated exchange rate regimes.
Define e-commerce and describe its advantages, disadvantages, and business models What are the advantages of business-to-business...
Define e-commerce and describe its advantages, disadvantages, and business models What are the advantages of business-to-business (B2B) e-commerce? Describe at least two categories of social networks and online media that collectively constitute social commerce.
Q1. Explain why cluster sampling is a probability sampling design. Describe a situation where you would...
Q1. Explain why cluster sampling is a probability sampling design. Describe a situation where you would consider the use of cluster sampling. Q2. Nonprobability sampling designs ought to be preferred to probability-sampling designs in some cases. Explain with an example.
Explain clearly the differences in stacking arrangements of the three crystal models constructed. Use the planes...
Explain clearly the differences in stacking arrangements of the three crystal models constructed. Use the planes of atoms to re-create the FCC and HCP crystal structure. a. How can the face-centered cubic and hexagonal close-packed structure be converted from one to the other? b. Could this happen in “real life” --- if yes, explain how?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT