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

Concept development of project, Concept Development Journal General In...

Concept Development Journal General Information: Once you have researched and gained some insight into the topic you must then begin developing your ideas and your conceptua

Is it possible to QuantifySoftware Engineering Risks using S, 1. Introducti...

1. Introduction to Software Metrics in Software Engineering.? 2. Role of direct and indirect measures in software process management? 3. Stance taken and justification? 4. Conclusi

Multiple instruction and single data stream (misd), Multiple Instruction an...

Multiple Instruction and Single Data stream (MISD) In this association, multiple processing elements are structured under the control of multiple control units. Each control un

What is organizational structure, What is Organizational Structure? A b...

What is Organizational Structure? A business organization may be structured in many dissimilar ways, depending upon the environment within which it handles.  There is always

Define the state and instance of properties of object, Define the state and...

Define the state and instance of properties of object A state encompasses all properties of object along with values of each of these properties. An instance is a concr

Average waiting time, Customer arrivals at a gas station can be characteriz...

Customer arrivals at a gas station can be characterized by exponential distribution with mean of 10 minutes. The amount of time they take to pump gas can be characterized by an ex

Search-based tools, The search-based tools initially identify the problem a...

The search-based tools initially identify the problem and after that appropriately give advice on how to correct it. AT Expert from Cray Research is one of the tools being used

Determine number of final selector in 10000 line exchange, In a 10000 line ...

In a 10000 line exchange, 0000 to 2999 is allotted to x group of subscribers, out of which 40% are active during busy hour. The remaining numbers are domestic numbers out of which

Pebble merchant, c programming code for pebble merchant

c programming code for pebble merchant

Shape - elements of composition, Shape : A shape is any area that can b...

Shape : A shape is any area that can be perceived to have height and width. Shapes within an image can be created by the use of line, or by the edges created by variations in c

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