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 the simulation is done - Weather simulation, How the simulation is done...

How the simulation is done -  Information from the satellites/sensors sent to computer -  This data is compared to information stored on files ..... -  ..... Which contain kno

Typewriters information distribution, TYPEWRITERS : Typewriter is the most...

TYPEWRITERS : Typewriter is the most common machine used in almost all offices. Typewritten letters are attractive in appearance as compared to handwritten ones. The same matter c

Shell script, shell script to find whether the given number is Armstrong or...

shell script to find whether the given number is Armstrong or not

Differences between OSI and TCP/IP reference models, What are the main diff...

What are the main differences between OSI and TCP/ IP reference models? Explain briefly. We will be considering only on the key differences among the two references models. Th

Binary resolution, Binary Resolution: However we saw unit resolution f...

Binary Resolution: However we saw unit resolution for a propositional inference rule in the previous lecture:  (A?  B,   ¬B) /A Thus we can take this a little further to

Distinguish between an agent system and an expert system, Problem : (a)...

Problem : (a) The concept of an agent is generally defined by listing the properties that agents exhibit. Identify and describe the properties that you would associate with th

What is batch processing, What is Batch processing In this process, a n...

What is Batch processing In this process, a number of tasks (or jobs) are all collected together over a set period of time. They are then all loaded into the computer system (i

Explain the use of ssl to secure the network, Explain the use of SSL to sec...

Explain the use of SSL to secure the network.  SSL (Secure Sockets Layer) is a protocol developed by Netscape for transferring private documents by the Internet. SSL works by u

Determine the benefits of developing prototype, Determine the benefits of d...

Determine the benefits of developing prototype According to SOMM [96] benefits of developing prototype are as following:  1.  Communication gap between clients and software

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