0

I want to modelate the producer consumer problem, with an infinite buffer that recive generate data from productor, and stores them by a priority level: High, Medium, Low.

Then, the consumer extract them and process then,asking only for one per time. The buffer will give the oldest one with highest priority. How can I do with use? I have modeled this:

model producerconsumer



class Productor
  attributes
    datos : String
`   prioridad: Prioridad
end

class priority < Productor
   attributes
   High: String
   Medium: String
   Low: String
end

class buffer
  attributes
    data : String
    time: int
  operations
    count(time):int
end

class consumer
   attributes
    data: String
   operations:
    extract(data)
    process():data

end

-- associations
association send between
  Productor [1] role input
  buffer [1] role output
end

association send between
  buffer [1] role input
  consumer [1] role output
end
Ed Willink
  • 1,205
  • 7
  • 8
jff
  • 300
  • 3
  • 14

0 Answers0