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

Design issues of multi-threaded processors, Q. Design issues of Multi-threa...

Q. Design issues of Multi-threaded processors? To accomplish the maximum processor utilization in a multithreaded architecture, the subsequent design issues should be addressed

When should we stop testing, When should you stop testing? It is quite ...

When should you stop testing? It is quite complex to determine as many modern software applications are so complex and run in like an interdependent environment that complete t

Determine the output waveforms for and and or gates, The voltage waveforms ...

The voltage waveforms shown in given fig. are applied at the inputs of 2-input AND and OR gates. Determine the output waveforms. Ans. The Output waveforms for AND and O

Explain form and input tag, Q. Explain FORM and INPUT Tag? A good way t...

Q. Explain FORM and INPUT Tag? A good way to learn about forms is to make use your notepad editor and make a new HTML document. Save it as form1.htm in some folder somewhere. Y

Develop the multi agent system, The new season of AFL, and the excited comi...

The new season of AFL, and the excited coming FIFA World Cup in South Africa this June, many sports fans are willing to find the latest results of their beloved sports teams. In th

How many tables can an append structure be assigned, To how many tables can...

To how many tables can an append structure be assigned. One table can be assigned to append structure.

Explain telnet, Explain Telnet Telnet is a Remote Login.

Explain Telnet Telnet is a Remote Login.

One can use the event get in a report without ldb attribute, One can use th...

One can use the event GET in a report without LDB attribute. False. no one can use the event GET in a report without attribute.

Where can i find conference information, Georg Thimm handles a webpage that...

Georg Thimm handles a webpage that lets you search for upcoming or past conferences in a range of AI disciplines.

Show the spawned program, Q. Show the spawned program? include "pvm3.h"...

Q. Show the spawned program? include "pvm3.h"  main() {    int ptid, msgtag;    char buf[100];    ptid = pvm_parent();    strcpy(buf, "hello, world from ");

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