Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Linux
hiiii every body please i need ur help for the problem of barber sleeping using monitor ( implementation c)
Posted 27-Dec-11 2:18am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
ahmedliver at 27-Dec-11 8:23am
   
please i just know the solution with semaphore but with monitors no so please i need ur helps for this problmes really it's difficult to find it
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

CLIENT processus [de 1 à N]
{
while (true) {
let_your_hair_grow ();
Barber_Shop.get_haircut call ();
}
}
 
processus de BARBER
{
while (true) {
Barber_Shop.get_next_customer call ();
coupe de cheveux ();
appelez Barber_Shop.finished_cut ();
}

 
suivre Barber_Shop
{
int barbier = 0; # chaise et les variables ouvertes ne sont pas nécessaires
cond barber_available;
cond chair_occupied;
cond door_open;
cond customer_left;
 
get_haircut procédure ()
{
while (Barber == 0) wait (barber_available);
barbier coiffeur = - 1;
Chaise # = 1 chaise;
signal (chair_occupied);
# While (ouvert == 0)
attendre (door_open);
# Open = ouvert -1;
signal (customer_left);
}

get_next_customer procédure ()
{
barbier coiffeur = + 1; signal (barber_available);
# While (chaise == 0)
attendre (chair_occupied);
# = Chaise chaise -1;
}

finished_cut procédure ()
{
# Open = ouvert une;
signal (door_open);
# While (ouvert> 0)
attendre (customer_left);
}
#} Suivre Barber_Shop
  Permalink  
Comments
ahmedliver at 27-Dec-11 8:27am
   
This is my program but i can't do the implementation on c(linux) so no one can give me the implementation in c?????

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Kornfeld Eliyahu Peter 265
1 Sergey Alexandrovich Kryukov 202
2 George Jonsson 185
3 King Fisher 185
4 CPallini 155
0 OriginalGriff 6,223
1 DamithSL 4,724
2 Maciej Los 4,196
3 Kornfeld Eliyahu Peter 3,894
4 Sergey Alexandrovich Kryukov 3,496


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 27 Dec 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100