
PUZZLE 8 SCHEDULING PRINTERS 29
PUZZLE
8 SCHEDULING PRINTERS
Yogesh Chacha ran into a problem and sent it to me on CompuServe on
September 12, 1996. Users in his shop usually end up using the wrong
printer for printout, thus they decided to include a new table in the
system that will derive the correct printer for each user at runtime. Their
table looked like this:
CREATE TABLE PrinterControl
(user_id CHAR(10), -- null means free printer
printer_name CHAR(4) NOT NULL PRIMARY KEY,
printer_description CHAR(40) NOT NULL);
The rules of operation are that:
1. If the user has an entry in the table, he will pick the
corresponding printer_name.
2. If the ...