Processes vs threads, Computer Engineering

Assignment Help:

One might argue that in general processes are more ?exible than threads. For one thing, they can live in two different machines, and communicate via sockets; they are easy to spawn remotely (e.g. ssh foo.cs.umass.edu "ls -l"); etc. However, using processes requires explicit com- munication and risks hackery. Threads also have their own problems: because they communicate through shared memory, they must run on the same machine and they require thread-safe code.

So even though threads are faster, they are much harder to program. In a sense, we can say that processes are far more robust than threads, since they are completely isolated from other another. Threads, on the other hand, are not that safe, since whenever one thread crashes the whole process terminates.

When comparing processes and threads, we can also analyze the cost of context switches. When- ever we need to switch between two processes, we must invalidate the TLB cache (the so-called TLB shootdown; see Section 6.2.3). Because warming up the TLB takes time, context switches for processes are slower.

On the other hand, when we switch between two threads, it is not necessary to invalidate the TLB, because all threads share the same address space, and thus have the same contents in the cache. In other words, on many operating systems, the cost of switching between threads is much smaller than the cost of switching between processes. Most large-scale systems use a mixture of processes and threads:

threads within a process on one server, communicating via a network socket to similar processes on other servers.


Related Discussions:- Processes vs threads

Processing elements (pes) -array processing, Processing elements (PEs)  : E...

Processing elements (PEs)  : Every processing element consists of ALU, local memory and its registers  for storage of distributed data. This PEs has been interconnected via an inte

Explain the state space of search problem, Question: (a) Assume you are...

Question: (a) Assume you are a taxi driver. Your taxi can hold four passengers. Passengers pay a flat fee for a ride to the airport, so your goal is to pick up four passengers

Algorithm, i need algorithm for padovan string

i need algorithm for padovan string

What is the disadvantage of strobe method, What is the  disadvantage of st...

What is the  disadvantage of strobe  method. The drawbacks of strobe method are that the source unit that show the transfer has no way of knowing whether the destination unit h

Show programming based on data parallelism, Q. Show Programming Based on Da...

Q. Show Programming Based on Data Parallelism? In data parallel programming model the focal point is on data distribution. Every processor works with a part of data. We will co

Symmetric and asymmetric encryption algorithms, Compare and contrast symmet...

Compare and contrast symmetric & asymmetric encryption algorithms. Your response should contain a brief overview of the cryptographic basis for every type of algorithm, and a compa

What are the various design constraints, What are the various Design constr...

What are the various Design constraints used while performing Synthesis for a design? 1. Make the clocks (frequency, duty-cycle). 2. Explain the transition-time requirements

Iterative deepening search, Iterative Deepening Search: So, breadth fi...

Iterative Deepening Search: So, breadth first search is always guaranteed to find a solution (if one exists), actually it eats all the memory. For the depth first search, ther

Define rules for evaluating the boolean expression, Define Rules For Evalua...

Define Rules For Evaluating the Boolean Expression? Generally, the following rules must always be followed when evaluating the Boolean expression: Primary, perform all in

Other equivalences, Equivalences: In this following miscellaneous equi...

Equivalences: In this following miscellaneous equivalence rules are often useful during rewriting sessions. So there the first two allow us to completely get rid of implicatio

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd