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

Double negation - artificial intelligence, Double Negation - Artificial int...

Double Negation - Artificial intelligence: Always parents are correcting their children for the use of double negatives, but we have to be very alert with them in natural langu

Subtract two number by using 1's complement, Subtract the given number usin...

Subtract the given number using 1's complement 11011 - 11001 Ans. 11011 - 11001 = X - Y                             X =    11011  1's complement of Y =    00110

Tag do you use to add a hyperlink column to the DataGrid, What tag do you u...

What tag do you use to add a hyperlink column to the DataGrid?   Anchor tag is used to add a hyperlink column to the data grid

What is the security vulnerabilities for vba, Microsoft Visual basic has it...

Microsoft Visual basic has its host of problems one such being macros, Macros can be formed which can make havoc for a programmer with good intentions. Also the security issue rest

What is the main use of structures, What is The main use of structures ...

What is The main use of structures The main use of structures is to lump together collections of disparate variable types, so they can conveniently be treated as a unit. For ex

What is scan, What is "Scan"? Scan Insertion and ATPG helps test ASICs ...

What is "Scan"? Scan Insertion and ATPG helps test ASICs (e.g. chips) during manufacture. If you know what JTAG boundary scan is, then Scan is the similar idea except that it i

Describe about remote-load latency problem, Q. Describe about Remote-load L...

Q. Describe about Remote-load Latency Problem? When one processor requires some remote loading of data from other nodes then processor has to wait for these two remote load ope

C++, Write a program to find the area under the curve y = f(x) between x = ...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Prove the equations using the boolean algebraic theorems, Prove the equatio...

Prove the equations A + A‾ .B + A.B‾ = A + B using the Boolean algebraic theorems ? Ans. The equation is A + A‾.B + A.B‾ = A + B L.H.S. = A + A‾ .B + A.B‾ = (A + A.B‾) + A‾.B

State about the directed-test methodology, Directed-Test Methodology Bu...

Directed-Test Methodology Building a directed verification environment with a comprehensive set of directed tests is very time-consuming and difficult. As directed tests only 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