AMX Buffer Manager
K
A
DAK
123
These solutions each have their own advantages and disadvantages. Method 1 requires
twice as many buffers as the other methods and requires extra processor time to copy the
message twice. Method 2 cannot display the message simultaneously on both the CRT
and printer. Also, method 2 requires the display task to know about the printer task's
mailbox. Method 3 is the most desirable.
Can method 3 be improved? Having the process control tasks know about the display
and printer makes future system modification difficult. Instead, a single reentrant
message routing procedure could be added to process all messages and determine if they
should be sent to the display task mailbox or printer task mailbox or both. If the message
routing procedure decided to send the buffer to both, it would call the Buffer Manager to
increase the buffer use count before passing the buffer on. As in method 3, the display
and printer tasks would only have to output the buffer, release it and then end. The
process control tasks would only have to get a buffer from the Buffer Manager, fill it with
a message and call the message routing procedure to send it to the appropriate task
mailboxes.
What if the messages have to be sorted by priority? Just use the task mailbox priorities
offered by the AMX message passing services.