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

Calculate register transfer time, Q. Calculate Register Transfer Time? ...

Q. Calculate Register Transfer Time? A clock isn't included explicitly in any statements discussed above. But it is presumed that all transfers take place during clock edge tra

Explain various fields in ipv6 base header, Explain various fields in IPV6 ...

Explain various fields in IPV6 base header? Although IPv6 base header is double as large as an IPv4 header, this contains less information. Given diagram demonstrates the forma

Define the pulse-triggered (master-slave) flip-flops, Define the Pulse-Trig...

Define the Pulse-Triggered (Master-Slave) Flip-flops? The term pulse-triggered signify that data are entered into the flip-flop on the rising edge of the clock pulse, though th

Describe critical directive in fortan, Q. Describe Critical Directive in FO...

Q. Describe Critical Directive in FORTAN? The critical directive permits one thread executes associated structured block. When one or more threads attain critical directive the

Difference between the fork -join and begin-end, Difference between the for...

Difference between the fork -join and begin-end. The fork - join keywords: Groups several statements together.Cause statements to be evaluated in parallel (all at the same

Different types of coding in digital electronics, The code where all succes...

The code where all successive numbers differ from their preceding number by single bit is ? Ans. Gray Code, where all successive numbers are different from their preceding nu

State the advantages of real time processing, Real time (transaction) proce...

Real time (transaction) processing In real time (transaction) processing files are generally updated in real time (for example when booking flights on an airplane); however in

Applications of electronic data interchange in business, What are the appli...

What are the applications of Electronic Data Interchange in business? The applications of Electronic Data Interchange are as given below: 1. Organisations that use EDI 2

Differences between internal and external fragmentation, Explain the differ...

Explain the differences between Internal and external fragmentation. Internal and external fragmentation (1) While memory allocated to a process is a little larger than th

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