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
Q. PVM communication model? A nonblocking receive as soon as returns with either data or a flag that data hasn't arrived while a blocking receive returns only when data is in r

Processor-Memory Interconnection Network (PMIN): It's a switch which attaches several processors to distinct memory modules. Connecting each processor to every memory module in

Subtraction of 01100-00011 using 2's complement method Ans. Firstly 1's complement of 00011 is 11100 and 2's complement is 11100 + 1 = 11101. Thus If a last carry is

The verification method states how Robot compares the baseline data captured while recording with the data captured during playback.

Make a console application to show different messages depending on the command line argument value. Use Select-case statements.(same to switch block)

Heuristic Search Strategies: Generally speaking that, a heuristic search is one which have uses a rule of thumb to improve an agent's performance in solving the problems via s

Why address bus is unidirectional and data bus is bidirectional? Ans) Because there is no require address transaction among processor and peripheral device but data bus is req

Define the Emphasis on Object Structure Emphasis on Object Structure, not on Operation Implementation In object orientation the importance is on specifying the qualities

Q. Illustrate does gas have density? Answer:- Gas in addition to everything in the universe has density though some densities are not either too high or too low to be dete

The Extensible Firmware Interface (EFI) is a specification that defines a software interface among an operating system and platform firmware. EFI is intended as a significantly imp