Mantis 1738 was created for this. Rich, Dave wrote On 02/14/07 00:35,: > OK, I see there are lots of misunderstandings. > > First of all, to define a bounded mailbox, you need three queues. > > There is the queue that holds the data, or the contents of the mailbox. > The FIFO ordering of that queue guarantees that the first piece of data > to be placed into the mailbox by a completed put/try_put will be the > first to be received from the mailbox by a successful get/try_get. > Completion means the blocking put/get returns (unblocks) or the > try_put/try_get returns true. > > When the mailbox if full, there is a queue of processes suspended on a > blocking put. That queue guarantees that a put completes in the same > order that they are suspended. That queue and the data queue give us the > strict FIFO ordering for puts. Similarly, there is a third queue of > processes suspended on a blocking get when the mailbox is empty. > > The problem is not with multiple blocking puts/gets or multiple > non-blocking try_puts/try_gets. The problem comes in when you start > mixing blocking puts with non-blocking try_puts or mixing blocking gets > with non-blocking try_gets. Look at this example which is a > simplification of a more complex example: > > mailbox #(int) mb = new(.bound(1)); > int t; > initial > begin > fork > mb.get(t); > join_none > #1 // some delay > mb.put(123); > void'(mb.try_get(t)); > assert(mb.num()==0); //this should never fail > end > > > If you accept that try_get() succeeds if and only if the size of the > mailbox is greater than 0, then you must also accept that try_get() > intercepts a suspended blocking get. > > > Dave > > > > -- --------------------------------------------------------------------- Neil Korpusik Tel: 408-720-4852 Senior Staff Engineer Fax: 408-720-4850 Frontend Technologies - ASICs & Processors (FTAP) Sun Microsystems email: neil.korpusik@sun.com --------------------------------------------------------------------- -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Wed Feb 14 11:32:03 2007
This archive was generated by hypermail 2.1.8 : Wed Feb 14 2007 - 11:32:13 PST