Note that some clients can be configured to run with higher latency and then can be scheduled less stringently without breaking up. Clients are allowed to write directly into the data buffer of the aubuf. A number of protection mechanisms could be deployed, such as the secure opcode facility provided on Nemesis for framebuffer access. However, the extra expense would not be worthwhile, because clients could still damage audio playback by placing malicious data in to the buffer. Note that the clients cannot crash the server or the machine by writing bad data in the buffer, so system stability is not affected.
Recording is easier to implement.
Any number of clients can easily read from the same aubuf data record, using the aubuf control record to calculate where to start reading from. The sound card runs in a mode whereby it repeatedly records into a buffer, issuing an interrupt that records a timestamp and increments a counter when it passes the top of the buffer, much as before. There are no protection issues with recording, however, as it is not necessary for the clients to have write access to anything. Multiple aubufs may be used by the same application because the aubuf abstraction never requires a client to block. The synchronous version never works ahead of the sound card by more than the total size of the DMA buffer.