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

Instruction set architecture - assembly language, Instruction Set Architect...

Instruction Set Architecture (ISA): The Instruction Set Architecture (ISA) is the part of the processor which is noticeable to the compiler writer or programmer. The ISA serve

What are the minimal cost and minimal risksolution, In binary representatio...

In binary representation there are some states that are believed to be never occurred because of some particular functionality of a given circuit. If zero output is assigned to suc

Determine the sampling rate of nyquist criterion, As per Nyquist criterion ...

As per Nyquist criterion the sampling rate is (A) 2fs                                                  (B) (1/2)fs (C) (1/2fs)

What is open database connectivity, What is Open Database Connectivity (ODB...

What is Open Database Connectivity (ODBC) It happens that in addition to conventional or most popular database management systems, many companies go for proprietary software c

Development of a successful system, The success of a system relies on the a...

The success of a system relies on the approach of building it. If development approach is right then system will work successfully. Figure below portrays a System Development Life

How does bus arbitration typically work, How does bus arbitration typically...

How does bus arbitration typically work? i.  A bus master waiting to use the bus asserts by  the bus request. ii.  A bus master cannot be the bus until it's request is grant

Characteristics of a computer memory systems, Question: a) Describe wha...

Question: a) Describe what is meant by a "bus". There are two types of bus, dedicated and multiplexed. Give a brief description of both types of buses. b) Briefly explain f

What is java applet, A Applet is a java program that runs within a web brow...

A Applet is a java program that runs within a web browser.

Thematic analysis - flash design, Thematic Analysis & Interpretation: ...

Thematic Analysis & Interpretation: The next steps in analysis are to move beyond what is literally there in the image (formal visual elements) and examine the meaning they re

Bernstein conditions for detection of parallelism, Bernstein Conditions for...

Bernstein Conditions for Detection of Parallelism For implementation of instructions or block of instructions in parallel, it should be guaranteed that the instructions are ind

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