subject

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 threads 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)
Thread-1
var b: pointer to type block;
while (1)
{
b:= unlink(freelist);
produce_information_in_block(b);
link(b, list1);
}
Thread-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);
}
Thread-3
var c: pointer to type block;
while(1)
{
c:=unlink(list-2);
consume_information_in_block(c);
link(c, freelist);
}
Using the POSIX library, rewrite the code for the threads, using semaphores to implement the necessary mutual exclusion and synchronization. The solution must be deadlock-free and concurrency should not be unnecessarily restricted.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:50
Can online classes such as gradpoint track your ip location like if im taking a final and i give somebody else my account and they take the final for me will it show where they are taking the final from? and can this be countered with a vpn
Answers: 1
question
Computers and Technology, 22.06.2019 23:00
In which part of a professional email should you try to be brief, but highly descriptive?
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
On early television stations, what typically filled the screen from around 11pm until 6am? test dummies test patterns tests testing colors
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Design a class tictactoe that: holds the following information about the game: two-dimensional array (3 by 3), and winner. add additional variables as needed. includes the functions to perform the various operations on objects. for example, function to print the board, getting the move, checking if move is valid, determining if there is a winner after each move. add additional operations as needed. includes constructor(s). write the functions of the class, and write a program that uses the class. the program should declare an object of type tictactoe. the program will create the board and store it in the array. the program will allow two players to play the tic-tac-toe game. after every valid move update the array, check if there is a winner. if there is no winner and no tie, then print the board again to continue.
Answers: 2
You know the right answer?
Consider a system with N blocks of storage, each of which holds one unit of information (e. g. an in...
Questions
question
History, 03.04.2020 02:09
question
Mathematics, 03.04.2020 02:09
question
Mathematics, 03.04.2020 02:09
question
Mathematics, 03.04.2020 02:09
Questions on the website: 13722359