Question

In: Computer Science

Please briefly explain the answer and why. (1) What are the differences between a process and...

Please briefly explain the answer and why.

(1) What are the differences between a process and a thread? Explain in perspectives of memory sharing, switching, communication, etc.


(2) In inter-process communication using message passing, there are two types of send/receive operations: blocking send/receive and non-blocking send/receive. What is the difference between the two approaches? Explain how the operations will behave when called.


(3) When a process is created, memory is allocated for the process. Describe each section of the memory allocated to the process, and what goes into each section.

Solutions

Expert Solution

Ans-(1)Definition-A process is a program under execution i.e an active program and a thread is a lightweight process that can be managed independently by a scheduler.

a)Memory Sharing-A process has its own address space where as a thread uses the process’s address space and shares it with the other threads of that process.

b)Context switching time-Processes require more time for context switching as they are heavier on the other hand Threads require less time for context switching as they are lighter than processes.

c)Communication-Communication between processes requires more time than between threads but Communication between threads requires less time than between processes.

d)Resource Consumption-Processes require more resources than threads but Threads generally need less resources than processes.

Ans-(2)Interprocess Communication-

Interprocess communication refers to the exchange of information between separate threads or processes. There are two basic models of interprocess communication. Information can be exchanged by utilising a shared region of memory between the communicating parties or by using explicit message passing primitives.

The message passing operations Send and Receive may be either blocking or non-blocking.

Blocking Send:  Sending process is blocked until the message passing mechanism has delivered the message to the receiving process or to a mailbox.

Non-Blocking Send: The sending process sends a message and can continue other tasks immediately while the message passing mechanism delivers the message.

Blocking Receive: Receiver waits until a message is received by it.

Non-Blocking Receive:   Receiver either gets an available message or a null value returned by the Receive primitive.

Ans-(3) When a program is loaded into the memory and it becomes a process, it can be divided into four sections ─ stack, heap, text and data. The attached image shows a simplified layout of a process inside main memory .

Component & Description:

Stack-The process Stack contains the temporary data such as method/function parameters, return address and local variables.

Heap-This is dynamically allocated memory to a process during its run time.

Text-This includes the current activity represented by the value of Program Counter and the contents of the processor's registers.

Data-This section contains the global and static variables.


Related Solutions

Briefly answer the followings. a. Explain the differences between probability distribution and sampling distribution. b. What...
Briefly answer the followings. a. Explain the differences between probability distribution and sampling distribution. b. What is the main difference of probability calculation between discrete and continuous random variables? c. Compare the characteristics of a t distribution and the standard normal distribution. d. What do you understand by the statement “The probability density function of a normal distribution is symmetric.
1. Briefly explain the differences between a semaphore and a condition variable, and what problem in...
1. Briefly explain the differences between a semaphore and a condition variable, and what problem in common these two synchronization primitives solve.
What is differences & similarities between Grameen, Kiva.org and Yunus Social Business. Please answer & Explain...
What is differences & similarities between Grameen, Kiva.org and Yunus Social Business. Please answer & Explain details
Please answer these three questions: 1. What are the differences in spectra between molecular and atomic...
Please answer these three questions: 1. What are the differences in spectra between molecular and atomic absorption? Explain these differences using the types of transitions. 2. UV-Vis instruments used to measure molecular absorption typically have a broad wavelength light source while atomic absorption instruments use a light source that produces very narrow bands of light. Both are typically in the same UV-Vis wavelength range. Why don’t they use the same source? 3. Alkenes such as n-hexane are used as solvents...
briefly explain elements of bonds and stocks . what are the mainn differences between common and...
briefly explain elements of bonds and stocks . what are the mainn differences between common and preffered stocks
Question 1:   Please explain the difference between the commerce clause and the due process clause. Why...
Question 1:   Please explain the difference between the commerce clause and the due process clause. Why are these two clauses so relevant in state and local tax cases? Please be specific and provide examples in your answer. Question 2: South Dakota v. Wayfair has been called the "tax case of the millennium." Explain why this SCOTUS decision is so important for nexus purposes. Also, what issues were left unanswered by the decision. Question 3: Discuss when a taxable sale occur...
What are two differences in the process of gene expression between prokaryotes and eukaryote and why?
What are two differences in the process of gene expression between prokaryotes and eukaryote and why?
Please answer all 1. What are the differences between elastic, inelastic, unitary elastic, perfectly elastic, and...
Please answer all 1. What are the differences between elastic, inelastic, unitary elastic, perfectly elastic, and perfectly inelastic? 2. What is the relationship and significance of price elasticity of demand to total expenditures by consumers and total revenue by firms? 3. How does the price elasticity of demand relate to the burden of a tax, consumer surplus, and producer surplus?
For each answer, please briefly explain the reasoning behind the answer. 1. True or False: For...
For each answer, please briefly explain the reasoning behind the answer. 1. True or False: For heat pumps, wcycle, irreversible > wcycle, reversible 2. True or False: All pure substances must have S = 0 at T = 0 K. 3. True or False: The maximum theoretical efficiency of a reversible heat engine will decrease if the working substance is a real gas instead of an ideal gas. 4. A reversible process is carried out on an ideal gas NOT...
Briefly explain what are coastal engineering structures and the differences between the two categories. Provide a...
Briefly explain what are coastal engineering structures and the differences between the two categories. Provide a brief history of the structure Ripraps and Gabions (including its category)   How widely is the structure used?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT