[ltp] Observation: /dev/dsp in kernel 2.6.16 can now be multiply opened!

Richard Neill linux-thinkpad@linux-thinkpad.org
Tue, 11 Jul 2006 15:13:50 +0100


wes schreiner wrote:

>> 5)Now, to my surprise, I discovered that even /dev/dsp can be opened 
>> by several applications at a time. This definitely never used to be 
>> the case!
>>
>> Eg:
>> play -d /dev/dsp somefile.ogg & play -d /dev/dsp otherfile.ogg
>> or even:
>> frozen-bubble & frozen-bubble & frozen-bubble & frozen-bubble &
>>
>>
>> This seems to have occurred as of kernel 2.6.16, and a very nice 
>> surprise it is too. I only discovered it by accident, so thought it 
>> worth passing on.
>>
>> Regards,
>>
>> Richard
>>
> 
> This has always been the case, but only for certain hardware that 
> supports multiple opens. All the mess with dmix or sound servers is to 
> get around the hardware that only supports a single open. So it isn't 
> your kernel version that matters, it is the sound hardware. For example, 
> the Intel ICH5 stuff on the box I'm on now is only single open, even 
> with 2.6.16. Yet the EMU10K could always do multiple opens, even with 
> 2.4.x and 2.2.x kernels.
> 
> What hardware are you using that supports multiple opens? A ThinkPad I'm 
> guessing, but what model?


Thanks for your explanation. That's really interesting. You are quite 
correct - even testing it with 2.6.12 allows it to work. I'm rather 
surprised though - I learned Linux on this machine 5 years ago - and
I'm sure it never used to be that simple.

Anyway, on an A22p, you can open the soundcard exactly 32 times 
simultaneously before it refuses to play more:

for i in `seq 1 32`; do (play -d /dev/dsp TheFlightofTheBumbleBee.ogg 
&); sleep 0.05; done

Results in rather a swarm of bees! And full CPU usage too.


My desktop machine (Intel Motherboard) doesn't support this. Neither 
does an X20.


Best wishes,

Richard