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

What is the function of an ip packet screening router, Function of an IP Pa...

Function of an IP Packet Screening Router: A screening router is the most basic type of firewall and uses only the packet filtering capability to control and monitor network tr

difference among primary and secondary storage device, In primary storage ...

In primary storage device the storage capacity is fixed. It has a volatile memory. In secondary storage device the storage capacity is not limited. It is a nonvolatile memory. Prim

What are the events used for page headers and footers, What are the events ...

What are the events used for page headers and footers? The events TOP-OF-PAGE and END-OF-PAGE are used for pager headers and footers.

Multi-operating systems, The assignment enhances the acquisition of new kno...

The assignment enhances the acquisition of new knowledge through reading, research and practical work in class and at home. It requires critical thinking applied to real life tasks

What types of data entry services do you perform, What types of data entry ...

What types of data entry services do you perform? Our business is to understand what data you require entered and in what particular format. After an initial analysis is perfor

What does realized mean, Realized mean that the component has been painted ...

Realized mean that the component has been painted on screen or that is prepared to be painted. Realization can take place by invoking any of these methods. setVisible(true), show()

Develop a plan to apply theory of constraints, 1. The Goal: Do you think th...

1. The Goal: Do you think that this is an operational methodology or a philosophy? Please explain. 2. How to apply Constraint Management to a Production Facility? How about to a

Register data type as combinational element, Reg data type as Combinational...

Reg data type as Combinational element module reg_combo_example( a, b, y); input a, b; output y; reg y; wire a, b; always @ ( a or b) begin y = a & b; e

Define the term package- object oriented modeling, Define the term package-...

Define the term package- object oriented modeling A package is a common purpose mechanism for organising elements into groups. Package can also contain other packages. The no

What are types of applets, There are two different parts of applets. Truste...

There are two different parts of applets. Trusted Applets and Untrusted applets. Trusted Applets are applets with predefined security and Untrusted Applets are applets without any

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