Docsity

Operating system Thread Lab work, Lab Reports of Operating Systems

Toggle sidebar
bg1
CSE 331
Operating Systems Design
Labwork 4 - Section 2
Building Water
Create a monitor with methods Hydrogen() and Oxygen(), which wait until a water molecule can
be formed and then return.
Do not worry about explicitly creating the water molecule; just wait until two hydrogen threads
and one oxygen thread can be grouped together.
For example, if one thread calls Oxygen, and then the second and third thread calls Hydrogen,
the third thread should wake up the first thread and they should then all return.
- Identify the correctness constraints of the problem
- Specify the conditions that each method must wait for
- Write down the shared state that you will use to check these conditions
- Implement a solution using only one lock

Partial preview of the text

Download Operating system Thread Lab work and more Lab Reports Operating Systems in PDF only on Docsity!

CSE 331

Operating Systems Design Labwork 4 - Section 2 Building Water Create a monitor with methods Hydrogen() and Oxygen(), which wait until a water molecule can be formed and then return. Do not worry about explicitly creating the water molecule; just wait until two hydrogen threads and one oxygen thread can be grouped together. For example, if one thread calls Oxygen, and then the second and third thread calls Hydrogen, the third thread should wake up the first thread and they should then all return.

  • Identify the correctness constraints of the problem
  • Specify the conditions that each method must wait for
  • Write down the shared state that you will use to check these conditions
  • Implement a solution using only one lock