3 ms·
Just curious, when developing a cross-platform application such as FF, would it make sense to implement an efficient lock within the FF codebase rather than rel
by whoisthemachine 4y ago
Just curious, when developing a cross-platform application such as FF, would it make sense to implement an efficient lock within the FF codebase rather than relying on undocumented OS functions?
- joeldo 4y agoMy understanding is that an efficient lock would require hardware support, which is surfaced by the OS.
- gsvelto 4y agoNo specific hardware support is needed to implement a lock. The atomic operations are all accessible from user-space - they are platform dependent though. The problem with locks is that they interact with scheduling and that's where the kernel comes in, that's why you need an OS-specific component too.
- joeldo 4y agoThat makes sense, thanks.
- gsvelto 4y agoIn a word: no. Efficient locks can only be implemented with significant involvement from the kernel. The best locks that can be implemented entirely in user-space will still suffer from the problems described in the article. Locks have complex interactions with scheduling and the only place where informed decisions can be made about them is within the kernel. That doesn't mean that good locks don't need a good user-space component - they do - but it's only one side of the coin.
- whoisthemachine 4y agoThanks, that completely makes sense, I hadn't thought of the scheduler's involvement.