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

How are control signals achieve the particular operation, Q. How are contro...

Q. How are control signals achieve the particular operation? The control signals are applied directly as binary inputs to the logic gates of the logic circuits. All these input

Explain switch statement, Switch This is another form of the multi way ...

Switch This is another form of the multi way decision. It is well structured, but can only be used in certain cases where; Only one variable is tested, all branches must

ERP, Benefits of implementing ERP

Benefits of implementing ERP

How do you recognize the performance bottlenecks, Performance Bottlenecks c...

Performance Bottlenecks can be identified by using monitors. These monitors might be application server monitors, database server monitors, web server monitors and network monitors

C LANGUAGE PROGRAMME, find a c program to find the area under the curve y=f...

find a c program to find the area under the curve y=f(x) between x=a and x=b,intregrate y=f(x)between the limits of a and b.the area under a curve between two points can be found b

Find the minimum sop and pos expression, Find the minimum SOP and POS expre...

Find the minimum SOP and POS expression for the following functions using Karnaugh Map and realize the expression using appropriate gates. Also realize SOP form using NAND-to-NAND

Compute the coefficient for classifier, Consider the data with categorical ...

Consider the data with categorical predictor x 1 = { green or red } and numerical predictor x 2 and the class variable y shown in the following table. The weights for a round

What is domain explain, Q. What is Domain explain? Domain can be an apa...

Q. What is Domain explain? Domain can be an apartment complex, a town or even a country. Sub-domains can correspond to organizations like expertsmind. United States comes under

In which page replacement policies balady’s anomaly occurs, In which page r...

In which page replacement policies Balady’s anomaly occurs? FIFO that is First in First Out.

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