It is possible to sort an array of n values using a pipeline of n filter processes. The first process inputs all the values one at a time, keeps the minimum, and passes the others on to the next process. Each filter does the same thing: it receives a stream of values from the previous process, keeps the smallest, and Chapter 7 Message Passing passes the others to the next process. Assume each process has local storage for only two values the next input value and the minimum it has seen so far. (a) Develop code for the filter processes. Declare the channels and use asyn- chronous message passing.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

4(a) The question for 4(a) is in the 1st image(7.3) - Filter Processes
Hint: Define an array of channels value[n] (int), and a set of filter processes Filter[i = 0 to n-1]. Each process Filter[i] (where 0 <= i <= n-2) receives a stream of integers through channel value[i], keeps the smallest, and sends out all other integers through channel value[i+1]. The last process Filter[n-1] receives only one integer through channel value[n-1], so it does not need to send out any integer. 

4(b) Asynchronous message passing , Reader- Writer problem in 2nd image

Readers/Writers Problem. Based on the monitor RW_Controller defined in Figure 5.5, Andrews' book,
page 216, develop a server process for read/write control using asynchronous message passing. Suppose
we have k reader processes and n-k writer processes, which are defined as follows:
type op kind = enum (READ_REQ, READ_DONE, WRITE_REQ, WRITE_DONE);
chan request (int client ID, op kind kind);
chan reply [n] ();
process Reader [i = 0 to k-1] {
while (true) {
send request (i, READ_REQ) ;
receive reply[i] ();
reading ...
send request (i, READ_DONE);
receive reply [i] ();
process Writer [i = k to n-1] {
while (true) {
}
Page 1 of 2
send request (i, WRITE_REQ) ;
receive reply[i] ();
writing ...
send request (i, WRITE_DONE);
receive reply[i] ();
Transcribed Image Text:Readers/Writers Problem. Based on the monitor RW_Controller defined in Figure 5.5, Andrews' book, page 216, develop a server process for read/write control using asynchronous message passing. Suppose we have k reader processes and n-k writer processes, which are defined as follows: type op kind = enum (READ_REQ, READ_DONE, WRITE_REQ, WRITE_DONE); chan request (int client ID, op kind kind); chan reply [n] (); process Reader [i = 0 to k-1] { while (true) { send request (i, READ_REQ) ; receive reply[i] (); reading ... send request (i, READ_DONE); receive reply [i] (); process Writer [i = k to n-1] { while (true) { } Page 1 of 2 send request (i, WRITE_REQ) ; receive reply[i] (); writing ... send request (i, WRITE_DONE); receive reply[i] ();
7.3 It is possible to sort an array of n values using a pipeline of n filter processes.
The first process inputs all the values one at a time, keeps the minimum, and
passes the others on to the next process. Each filter does the same thing: it
receives a stream of values from the previous process, keeps the smallest, and
Chapter 7 Message Passing
passes the others to the next process. Assume each process has local storage for
only two values--the next input value and the minimum it has seen so far.
(a) Develop code for the filter processes. Declare the channels and use asyn-
chronous message passing.
Transcribed Image Text:7.3 It is possible to sort an array of n values using a pipeline of n filter processes. The first process inputs all the values one at a time, keeps the minimum, and passes the others on to the next process. Each filter does the same thing: it receives a stream of values from the previous process, keeps the smallest, and Chapter 7 Message Passing passes the others to the next process. Assume each process has local storage for only two values--the next input value and the minimum it has seen so far. (a) Develop code for the filter processes. Declare the channels and use asyn- chronous message passing.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Race Condition
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education