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

Vugen recording and scripting, LoadRunner script code acquired from recordi...

LoadRunner script code acquired from recording in the ANSI C language syntax, shown by icons in icon view until you click Script View.

Calculate grade of service in a particular excahange, In a particular excha...

In a particular exchange during busy hour 1200 calls were offered to a group of trunks, during this time 6 calls were lost. The average call duration being 3 minutes Calculate

Android projects, how should I do connectivity with google play for my andr...

how should I do connectivity with google play for my android GSM based project

Software characteristics, Software Characteristics: Software is en...

Software Characteristics: Software is engineered and developed. Software can't "wear-out". Most of the software continues to be routine built. The term in

The last character of the ldb name, The last character of the LDB name deno...

The last character of the LDB name denote?? Application

Estimate the circuit switched network, a) Total available bandwidth = 1 Mbp...

a) Total available bandwidth = 1 Mbps = 1000 Kbps Each user requires send data at the rate of = 500 kbps As it is circuit switched network we have to dedicate the bandwidth So the

Explain the virtual memory, What is virtual memory?  Virtual memory is ...

What is virtual memory?  Virtual memory is a technique that permits the execution of processes that may not be completely in memory. It is the separation of user logical memory

What are the input for uml development, What are the Input for UML developm...

What are the Input for UML development UML is an attempt to standardize artefacts of analysis and design consisting of semantic models, diagrams and syntactic notations. The fi

Convert the decimal number into its equivalent binary number, Write a progr...

Write a program to convert the given Decimal number into its equivalent Binary number.

Pipeline, where can I find detailed explanation of 6 stage and 7 stage pipe...

where can I find detailed explanation of 6 stage and 7 stage pipeline ??

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