Processes vs threads, Computer Engineering

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.

Posted Date: 3/12/2013 4:17:35 AM | Location : United States







Related Discussions:- Processes vs threads, Assignment Help, Ask Question on Processes vs threads, Get Answer, Expert's Help, Processes vs threads Discussions

Write discussion on Processes vs threads
Your posts are moderated
Related Questions
What is page frame? An area in the main memory that can hold single page is called as page frame.

What are virtual Functions

Q. Catch output from child tasks? int pvm_catchout( FILE *ff ) Catch output from child tasks. ff is file descriptor on which we write collected output. The defau

Write the HTML code to accomplish the web page to insert an image onto a page using good.gif as image and having "welcome" as the ALT text. The HTML code to accomplish the web

The most important in the project are to develop application: 1- Web Conference this will help both the jobseeker and employer to meet through web conference and follow the proc

Q. Show typical microprocessor system architecture? A microprocessor system bus consists of three physical buses: the address bus, the data bus, and the control bus. The types

Determine how Simulation can be developed To determine how a simulation can be developed for use in a real situation the below illustration has been chosen. Scenario chosen is

Describe session handling in a web farm, how does it work and what are the limits ?   In ASP.NET there are three ways to handle session objects. Single support the in-proc mec

Q. Define the Arithmetic Micro-operations? These micro-operations execute simple arithmetic operations on numeric data stored in registers. The fundamental arithmetic micro-ope

Q. Explain the odd-even transposition algorithm? The algorithm needs one 'for loop' beginning from I=1 to N it implies that N times and for every value of I, one 'for loop' of