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

Page translation table, Make a page translation table the meets the require...

Make a page translation table the meets the requirements of the virtual memory system given below.  Suppose page (and frame) sizes of 20 with pages 0 by 3 in logical memory and fra

What is java applet, A Applet is a java program that runs within a web brow...

A Applet is a java program that runs within a web browser.

What is data movement, Data movement instructions shift data from one locat...

Data movement instructions shift data from one location to another. The source and destination locations are verified by the addressing modes, and can be registers or memory. Many

Explain level of a node, Level of a node The root is at level zero and ...

Level of a node The root is at level zero and the level of the node is 1 more than the level of its parent

What is charge-coupled devices, Q. What is Charge-coupled Devices? CCDs...

Q. What is Charge-coupled Devices? CCDs are employed for storing information. They have arrays of cells that can hold charge packets of electron. A word is signified by a set o

Modus ponens rule, Modus ponens rule: In fact the general format for t...

Modus ponens rule: In fact the general format for the modus ponens rule is as follows: like if we have a true sentence that states the proposition A implies proposition B and

replacing option of a copy statement, What is the point of the REPLACING o...

What is the point of the REPLACING option of a copy statement? Ans) REPLACING permits for the similar copy to be used more than once in the similar code by changing the replac

Mathematical applications, The current 32 and 64 bit machines can represent...

The current 32 and 64 bit machines can represent integers of around 9 digits and 30 digits respectively, while various scientific and mathematical applications have to represent in

Give the example of first come first served scheduling, Consider  the  foll...

Consider  the  following set of jobs with  their  arrival  times,  execution  time  (in minutes), and deadlines. Job Ids Ar r ival Time E

Design a 1-bit full adder, Design a 1-bit full adder: Verify your desig...

Design a 1-bit full adder: Verify your design Use the 1-bit full adder to build a 4-bit adder with Ci=0 Verify: 1 + 4, and 9 + 9 Sram design: Cell: p - 0.5/0.045;

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