Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider a system with N blocks of storage, each of which holds one unit of information (e.g. an integer, character, or employee record). Initially, these

Consider a system with N blocks of storage, each of which holds one unit of information (e.g. an integer,

character, or employee record). Initially, these blocks are empty and are linked onto a list called freelist.

Three processes communicate using shared memory in the following manner:

Shared Variables: freelist, list-1, list-2: block (where block is some data type to hold items)

PROCESS #1

var b: pointer to type block;

while (1)

{

b:= unlink(freelist);

produce_information_in_block(b);

link(b, list1);

}

PROCESS #2

var x,y: pointer to type block;

while (1)

{

x:=unlink(list-1);

y:=unlink(freelist);

use_block_x_to_produce info_in_y(x, y);

link(x, freelist);

link(y, list-2);

}

PROCESS #3

var c: pointer to type block;

while(1)

{

c:=unlink(list-2);

consume_information_in_block(c);

link(c, freelist);

}

Using the appropriate libraries, rewrite the pseudo-code as actual Unix/Linux processes, using semaphores to

implement the necessary mutual exclusion and synchronization. The solution must be deadlock-free and

concurrency should not be unnecessarily restricted. Further, you will have to implement a correct representation

of the three lists so that access to them is shared among the processes

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

What impediments originate in society at large?

Answered: 1 week ago

Question

6. Is all Internet training the same? Explain.

Answered: 1 week ago