Operating System
Practical Presentation



                 Jonathan Arturo Alvarado Mata   
                 1441616
                 Carlos Eduardo Triana Sarmiento
                 1412573
                 Obed David Guevara Ibarra          
                 1447478

 Blog:
 http://os-
 ocj.blogspot.com/
What we did?
We made the program of Bounded buffer producer-
consumer.
Our program use a thread for producer, and other
thread for consumer.
 
What we use?
We use 2 kinds of semaphores ...
A two-valued or binary semaphore that implements
mutual exclusion

And the other kind of semaphore is a multiple-valued or
counting semaphores that implements synchronized
counts of shared resources
Practical presentation
Where is our code?
Our code is in the file
nachos/code/threads/threadtest.cc  

How do we compile our code?
We open a terminal and go to /nachos/code
Then we type: make
This instruction will compile all our code of nachOS

How do we execute our code?
In the terminal we go to /nachos/code/threads/ 

Then we type: ./nachos

This will execute our code
Producer                Consumer
Function                 Function
semaphore mutex = 1; 
semaphore empty = N;     void consumer() {
semaphore full = 0;            while(1) { 
                                     P(full); 
void producer() {                    P(mutex); 
     while (1) {                     V(mutex); 
         P(empty);                   V(empty); 
         P(mutex);                   Product--; 
         Product++;          }     
         V(mutex);       }
         V(full); 
     }
 }
Bibliography

    • http://www.isi.edu/~faber/cs402/notes/lecture7.html
 
    • http://black.goucher.edu/~kelliher/cs42/oct02.html
 
    • http://www.mitecnologico.com/Main/Mutex

Practical presentation

  • 1.
    Operating System Practical Presentation Jonathan Arturo Alvarado Mata    1441616 Carlos Eduardo Triana Sarmiento 1412573 Obed David Guevara Ibarra           1447478 Blog: http://os- ocj.blogspot.com/
  • 2.
    What we did? Wemade the program of Bounded buffer producer- consumer. Our program use a thread for producer, and other thread for consumer.   What we use? We use 2 kinds of semaphores ... A two-valued or binary semaphore that implements mutual exclusion And the other kind of semaphore is a multiple-valued or counting semaphores that implements synchronized counts of shared resources
  • 3.
    Practical presentation Where isour code? Our code is in the file nachos/code/threads/threadtest.cc   How do we compile our code? We open a terminal and go to /nachos/code Then we type: make This instruction will compile all our code of nachOS How do we execute our code? In the terminal we go to /nachos/code/threads/  Then we type: ./nachos This will execute our code
  • 4.
    Producer Consumer Function Function semaphore mutex = 1;  semaphore empty = N;  void consumer() { semaphore full = 0;       while(1) {                P(full);  void producer() {              P(mutex);       while (1) {              V(mutex);           P(empty);              V(empty);           P(mutex);              Product--;           Product++;      }               V(mutex);  }          V(full);       }  }
  • 5.
    Bibliography • http://www.isi.edu/~faber/cs402/notes/lecture7.html   • http://black.goucher.edu/~kelliher/cs42/oct02.html   • http://www.mitecnologico.com/Main/Mutex