W3C home > Mailing lists > Public > public-audio@w3.org > July to September 2013

ROC's Proposal for fixing race conditions

From: Jer Noble <jer.noble@apple.com>
Date: Thu, 08 Aug 2013 22:53:50 -0700
Message-id: <D439D009-B2F8-456E-B133-B0BD09E28C6D@apple.com>
To: WG <public-audio@w3.org>
Robert,

Thanks for posting your proposal <https://wiki.mozilla.org/User:Roc/AudioBufferProposal>.

It seems as though your proposal could be implemented on any platform with support for copy-on-write page semantics, without requiring neutering any outstanding ArrayBuffers.  E.g., on Posix platforms, the "acquire the contents" step could simply mmap(MAP_PRIVATE) the source memory, and if the original memory contents are modified, the AudioBuffer gets a fresh copy. 

Just as in your proposal, if no one attempts to modify the contents of the AudioBuffer while the contents are "acquired", there is no memory cost, apart from the cost of the mmap() call itself.  If the contents were modified while acquired, they could easily be re-acquired the next time the AudioBuffer is made "live", meaning changes made to "acquired" buffers would propogate to AudioNodes in defined and deterministic ways.  

Implementations in "memory safe" languages without access to low level system calls could use mutexes and read-write locks to achieve the requirement.

So why specify these explicit mechanisms (such as neutering), rather than just a general, implementable requirement: "Modifications to 'acquired contents' must have no affect on live nodes." and allow implementations to fulfill this requirement however they see fit? 

-Jer
Received on Friday, 9 August 2013 05:54:19 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:03:23 UTC