Give solution for readers-writers problem, Computer Engineering

Assignment Help:

Give a solution for readers-writers problem using conditional critical regions.

Solution for readers-writers problem using conditional critical regions:

Conditional critical region is a high-level synchronization construct. We suppose that a process have some local data, and a sequential program which can operate on the data. The local data can be accessed through only the sequential program which is encapsulated in same process. One process can't directly access the local data of the other process. However, processes can, share global data.

Conditional critical region synchronization construct needs that a variable v of type T, that is to be shared among several processes, be declared as v: shared T; The variable v can be accessed only within a region statement of the following form: region v while B do S;

This construct implies that, while statement S is being executed, no other process can access the variable v. while a process tries to enter the critical-section region, the Boolean expression B is calculated. If the expression is true, statement S is executed. If this is false, the process releases the mutual exclusion and is delayed till B becomes true and no other process is in the region connected with v.

Here, let A is the shared data object.

Assume that readcount is the variable which keeps track of how many processes are currently reading the object A.

Assume that writecount is the variable which keeps track of how many processes are currently writing the object A. simply one writer can update object A, at a specified time.

Both variables readcount and writecount are initialized to 0.

A writer can update the shared object A while no reader is reading the object A.

region A when( readcount = = 0 AND writecount = = 0){

......

writing is performed

...... }

A reader can read the shared object A unless a writer has acquired permission to update the object A.

region A when (readcount >=0 AND writecount = = 0){

......

reading is performed ...... }


Related Discussions:- Give solution for readers-writers problem

Explain about diodes, Q. Explain about Diodes? A single pn-junction wit...

Q. Explain about Diodes? A single pn-junction with appropriate contacts for connecting the junction to external circuits is called a semiconductor pn-junction diode. The fundam

Java database connectivity, Java Database Connectivity (JDBC) With two...

Java Database Connectivity (JDBC) With two different types of technologies available in the market today viz., the Windows and the Java technologies developed by the Microsoft

Creates a grid-matrix of cells, 1. Write the function makegrid. This functi...

1. Write the function makegrid. This function accepts a width and height and creates a grid/matrix of cells. The width gives the number of columns and the height the number of rows

Oo modelling, We might model such a scenario using three types of object: o...

We might model such a scenario using three types of object: one for Customers, one for BankAccounts and another for Transactions. In terms of data required, for Customers assume we

Which class used for multicasting in ip addressing scheme, In IP addressing...

In IP addressing scheme, class used for multicasting is: A class used for multicasting in IP addressing scheme is class D.

Internet application development, As an employee of an up and coming web De...

As an employee of an up and coming web Design Company, you have been approached by a small local cinema, called Valley Viewing who are looking to revamp their existing HTML website

What are the rules of timescale directive, What are the Rules of Timescale ...

What are the Rules of Timescale directive Rules -  'Timescale directive, like all compiler directives, affects all modules compiled after directive,  whether  in  same  fi

Define entry section and exit section, Define entry section and exit sectio...

Define entry section and exit section. The critical section problem is to design a protocol that the processes can use to cooperate. Every process must request permission to e

Make your simulation run faster, Ameliorating the mechanical delays of seek...

Ameliorating the mechanical delays of seeks and rottion are usually regardeed as major aspects of device drivers for disks. The simplest way for a disk device driver to service dis

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