Results 1 to 3 of 3
  1. #1
    Micky is offline Member
    Join Date
    Oct 2016
    Posts
    4
    Rep Power
    0

    Lightbulb java multi threading problem

    Hello everyone,

    I am new to multi threading programming in java, and was trying to solve a problem but seems quite confusing. Can anyone give me some information about it? It's similar to barber problem, but a bit more advanced.

    I have attached the document in the attachment.

    Please explain it to me, I shall be very thankful.
    Attached Files Attached Files
    Last edited by Micky; 10-19-2016 at 08:39 PM.

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: java multi threading problem

    Not certain what more I could explain. Is this for homework or just for personnel fulfillment? The reason I ask is because
    the task implies that it is up to you to manage your customer queue(s) and hairdresser queue. This could be done using
    some of the classes in the java.util.concurrent instead of rolling your own.

    Also, unless it is for school and you must have a standing queue and a sitting queue, you could simply have a single queue
    of 20 customers (the first 10 are sitting and the next 10 are standing).

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    Micky is offline Member
    Join Date
    Oct 2016
    Posts
    4
    Rep Power
    0

    Default Re: java multi threading problem

    Quote Originally Posted by jim829 View Post
    Not certain what more I could explain. Is this for homework or just for personnel fulfillment? The reason I ask is because
    the task implies that it is up to you to manage your customer queue(s) and hairdresser queue. This could be done using
    some of the classes in the java.util.concurrent instead of rolling your own.

    Also, unless it is for school and you must have a standing queue and a sitting queue, you could simply have a single queue
    of 20 customers (the first 10 are sitting and the next 10 are standing).

    Regards,
    Jim


    Yes it's part of homework. I am thinking to apply semaphore for standing and sitting. Either I can have separate for sitting and standing, or just one with 20 as limit. I am confused with e.g. classes, do I need to have hair dresser as an array in Salon class. So far I think I need 4 classes, hair dresses, salon, customer, and a main class.

    and I think I need to lock hair dresser and scissor and comb. So this part is where I am stuck.



    P.S: Will I have to create a class for comb and scissor as well? to get lock on them?
    Last edited by Micky; 10-19-2016 at 11:06 PM.

Similar Threads

  1. Problem with use of Multi threading with DOM object
    By gdev in forum Threads and Synchronization
    Replies: 1
    Last Post: 05-21-2014, 07:59 PM
  2. Replies: 4
    Last Post: 11-27-2012, 11:07 AM
  3. multi-threading problem
    By imorio in forum New To Java
    Replies: 1
    Last Post: 04-25-2011, 06:52 PM
  4. Problem in Multi threading.
    By Chetans in forum Advanced Java
    Replies: 3
    Last Post: 03-23-2010, 04:42 PM
  5. question about Multi threading in Java
    By fred in forum Advanced Java
    Replies: 1
    Last Post: 07-24-2007, 01:55 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •