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

Explain about indirect addressing, Q. Explain about Indirect Addressing? ...

Q. Explain about Indirect Addressing? In this technique the operand field of instruction specifies the address of address of intended operand for example if instruction LOAD

What is a formal description for a programming language, A grammar for a pr...

A grammar for a programming language is a formal description of ? Structure is a formal description for a programming language.

What property of the architecture of 3g networks, Question: (a) Explain...

Question: (a) Explain how a Mobile Terminating call, from a PSTN phone, is processed in a GSM network. Illustrate your answer with a diagram. (b) Top-Net, a new telecommuni

Fuzzy logic - artificial intelligence, Fuzzy Logic - artificial intelligenc...

Fuzzy Logic - artificial intelligence: In the above logic, we have been concerned with truth whether propositions and sentences are true. But, with some natural language statem

What is accumulator register, Q. What is Accumulator Register? Accumula...

Q. What is Accumulator Register? Accumulator Register (AC):  This register is used to store data temporarily for computation by Arithmetic and logic unit (ALU).  AC generally c

What is an orthogonal base class in c++, If two base classes have no overla...

If two base classes have no overlapping methods or data they are said to be independent of, or orthogonal to each other. Orthogonal in the sense means that two classes function in

Explain semaphore, What is a semaphore? Semaphore: It is a synchroniz...

What is a semaphore? Semaphore: It is a synchronization tool which gives a general-purpose solution to controlling access to critical sections.

Define ufd and mfd, Define UFD and MFD.   In the two-level directory st...

Define UFD and MFD.   In the two-level directory structure, every user has own user file directory (UFD). Every UFD has a same structure, but lists only the files of a single u

What is the use of urgent pointer in tcp segment, What is the use of urgent...

What is the use of urgent pointer in TCP segment? For accommodation out of band signaling, TCP permits the sender to identify data as urgent, implies that the receiving program

Mention the various IC logic families, Mention the various IC logic familie...

Mention the various IC logic families. Ans. Different  IC Logic Families: Digital IC's are fabricated through employing either the Unipolar or the Bipolar Technologies and are te

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