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 are packages, What are packages? Package is a group of elements (c...

What are packages? Package is a group of elements (classes, generalizations, associations and lesser packages) with a common theme. Package partitions a model making it simpler

Perform binary addition, Q. Explain the following: a. BCD code b. Gra...

Q. Explain the following: a. BCD code b. Gray code c. Excess-3 code d. True complement method Q. Addition-Subtraction-Multiplication-Division: Perform Binary Addi

How steps of instruction execution can be broken down, Q. How steps of inst...

Q. How steps of instruction execution can be broken down? Let's explain how these steps of instruction execution can be broken down to micro-operations. To make easier this dis

Find minimal expression for sop, Consider the following expression. Assume ...

Consider the following expression. Assume that complement inputs are available. F(A,B,C,D) = ∑m (0,1,3,5,9,12,14) + ∑d (4,10,15) 1. Find minimal expression for SOP. Draw gate ne

Show the conflict in register, Q. Show the conflict in register? All mi...

Q. Show the conflict in register? All micro-operations written on a line are to be executed at same time provided the statements or a group of statements to be implemented toge

Give example of stack using encapsulation of OOA, Give example of stack usi...

Give example of stack using encapsulation of OOA An example of the Stack.  A Stack abstraction provides methods like pop (), push (), isEmpty(), isFull(). The Stack can be i

What is replacement algorithm, What is replacement algorithm? When the ...

What is replacement algorithm? When the cache is full and a memory word that is not in the cache is referenced, the cache control hardware must decide which block should be del

Define access time for magnetic disk, Define access time for magnetic disk....

Define access time for magnetic disk. The sum of seek time and rotational delay is known as access time for disks. Normal 0 false false false EN-IN

What is uml, ? UML is called as Unified Modeling Language. ? it is used...

? UML is called as Unified Modeling Language. ? it is used to Graphical language for visualizing artifacts of the system. ? It Allow to make a blue print of all the aspects

Explain the term- viruses, Explain the term- Viruses Use of firewalls a...

Explain the term- Viruses Use of firewalls and ant-virus software to prevent viruses entering a computer. It's also sensible not to open attachments/emails from "unknown" sourc

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