Explain the methods of implementing interacting processes, Computer Engineering

Assignment Help:

Explain any two methods of implementing interacting processes.

Two methods of implementing interacting process are given below:

(i) Shared memory solution: In this scheme requires that such processes share a common buffer pool and the code for implementing the buffer is written through the application programmer.

For illustration, a shared-memory solution can be given to the bounded- buffer problem. The producer and consumer processes share the subsequent variables:

#define BUFFER_SIZE 10

Typedef struct{

..........

 }item;

Item buffer[BUFFER_SIZE];

int in=0;

int out=0;

The shared buffer is implemented like a circular array along with two logical pointers: in/out. The variable in-points to the next free position into the buffer, out-points to the first full position into the buffer. The buffer is empty while in==out; the buffer is full while (( in + 1)%BUFFER_SIZE)==out.

The producer process has a local variable nextProduced wherein the new item to be produced is stored:

while(1){

/* produce and item in nextProduced */ While(((in + 1)%BUFFER_SIZE)==out)

; // don't do anything

Buffer[in]=nextProduced;

in =(in+1)% BUFFER_SIZE;}

The consumer process has a local variable nextConsumed in which the item to be consumed is stored:

while(1){

while(in==out)

; // don't do anything

nextConsumed = buffer[out];

out=(out +1)% BUFFER_SIZE;

/* consume the item in nextConsumed */}

(ii) Inter process Communication: The OS gives the means for cooperating processes to communicate with each other through an inter-process communication (IPC) facility. IPC gives a mechanism to allow processes to communicate and to synchronize their actions without sharing similar address space. IPC is particularly helpful in a distributed environment where the communicating processes may reside on various computers connected with a network. IPC is best implemented through message passing system where communication among the user processes is accomplished by the passing of messages. An

Inter-process communication facility gives at least the two operations: send(message) and receive(message).


Related Discussions:- Explain the methods of implementing interacting processes

Compare electromechanical and electronic switching system, Compare electrom...

Compare electromechanical switching system with electronic switching system. Comparison of electromechanical switching system with electronic switching systemgiven below:

Write an xpath expression, Question: (a) Explain the five different t...

Question: (a) Explain the five different types of element content defined by DTDs. (b) Compare XML schema's against DTDs. (c) Consider the following two element decla

Processes of information system, Processes of Information System The b...

Processes of Information System The basic purpose of the Information System is to convert and manage data into something that is meaningful. Bocij et al (2003) lists the basic

What is parsing, What is parsing? Parsing is the process of analyzing a...

What is parsing? Parsing is the process of analyzing a text, formed of a sequence of tokens, to find out its grammatical structure regarding a specified formal grammar. Parsing

Application area of artificial intelligence, 1. The State of the Art: What ...

1. The State of the Art: What can AI do today? A concise answer is difficult because there are so many activities in so many subfields. Here we sample a few applications other

How are problems of clock skew minimized, How are problems of clock skew mi...

How are problems of clock skew minimized? Clock skew, when done right, can also benefit a circuit. This can be intentionally introduced to reduce the clock period, at that the

What do you understand by hit ratio, What do you understand by Hit ratio? ...

What do you understand by Hit ratio? When a processor refers a data item from a cache, if the referenced item is in the cache, then such a reference is called hit. If the refer

Develop system flow charts - nasa near earth object, Background Information...

Background Information The National Aeronautics and Space Administration (NASA) is the agency within the United States Government responsible for US space exploration. Within th

Explain loop-invariant code motion, Explain briefly Loop-invariant code ...

Explain briefly Loop-invariant code motion of the commonly used code optimization techniques. Loop-invariant code motion If a quantity is calculated inside a loop duri

What is a linker program, What is a linker program? Ans. links the prog...

What is a linker program? Ans. links the program with other programs required for its execution is called a linker program.

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