News for hackers. Stuff that matters.
Re:Switching to Linux: A Windows developer’s view by modeless on Monday September 14, 2009 @01:59PM (#822197)
Choosing Linux for stable APIs would be rather silly. X11 is evolving rapidly nowadays and audio APIs are in a state of constant flux, where the different APIs often interfere with each other and there's no obvious best solution. Linux changes ABIs all the time and is notorious for C library incompatibilities. This recent mess with filesystem write semantics (http://lwn.net/Articles/322823/ ) has proven you can't even rely on POSIX.

Meanwhile, Win32 has been far more stable over the years and Microsoft has put a ton of effort into backwards compatibility. Don't get me wrong; I like Linux but API stability is not the reason to choose it over Windows.

Re:Switching to Linux: A Windows developer’s view by rbanffy on Monday September 14, 2009 @02:51PM (#822340)
"This recent mess with filesystem write semantics (http://lwn.net/Articles/322823/ ) has proven you can't even rely on POSIX."

I have to disagree.

The "problem" resides in the way ext4 writes data to the disk. If you need crash-resistance (the data-loss occurs on computer crashes) ext4 is not for you. And keep in mind if you really need it, ext3 isn't for you either. JFS or XFS, perhaps, and ZFS, but I never intentionally crashed a machine with unwritten data since, perhaps, my Apple II days.

This has nothing to do with POSIX.

Re:Switching to Linux: A Windows developer’s view by jacquesm on Monday September 14, 2009 @03:24PM (#822408)
I have several hundred million files stored on XFS, not sure if that's a lot or a little by HN standards, but maybe it counts for something.

We will never ever have another XFS setup with a filesystem where deletions are to be expected. XFS works fine as long as you are just adding files to the filesystem, deletions are pathologically slow.

We've tried just about every trick in the book and have finally made the decision to switch back to ext3, which given the number of files will take a while.

So, that's nothing against XFS from a reliability point of view, but definitely from a performance point of view.

Re:Switching to Linux: A Windows developer’s view by rbanffy on Monday September 14, 2009 @04:29PM (#822549)
Interesting. I had a meeting where XFS got high praises from a very knowledgeable person. The catch is that in this solution, files are added and appended and very seldom deleted.
Re:Switching to Linux: A Windows developer’s view by jacquesm on Monday September 14, 2009 @04:45PM (#822577)
Our usage is pretty specific, it took us a while to narrow this down to XFS mainly because it was hard to believe how slow it was.

Deletion can be much slower than file creation if the files are small.

If you google for 'xfs delete speed' you'll get plenty of bits of information, the best fix was the 'nobarrier' option.

Deleting files at random is especially bad.

Re:Switching to Linux: A Windows developer’s view by blasdel on Monday September 14, 2009 @05:17PM (#822639)
Deletion can be much slower than file creation when the files are hundreds of mb too!

Worst of all, "rm -R" runs right into XFS's most pathological case -- it's doing tons of metadata reads while it unlinks files, and XFS shoves a lock in every orifice.

Re:Switching to Linux: A Windows developer’s view by vlisivka on Monday September 14, 2009 @04:33PM (#822556)
Ext4 - is badly configured Ext3 (data=writeback mode) with extents support. By default, in recent kernels, Ext3 is configured in same way as Ext4 (data=writeback). In RedHat/Fedora/CentOS/etc., Ext4 is configured properly (data=ordered): "Don't worry about the new default journaling mode for ext3 planned for 2.6.30 (data=writeback, which is much faster than the old default, data=ordered, but has enormous security and data integrity problems). No distro would ship this as the default. The only way it could happen at Red Hat is over the dead bodies of the security team, who, let me tell you, keep an eagle eye on file system data leaks like this."

Ext4 is not alone - other file systems (Ext3, XFS, maybe others) are patched to support new file rewrite semantic too.

PS. I saw lot of zero-padded files on XFS until switched to Ext3 with data=ordered.

Re:Switching to Linux: A Windows developer’s view by rbanffy on Monday September 14, 2009 @05:33PM (#822660)
Can this be selected by mountpoint at /etc/fstab ?
Re:Switching to Linux: A Windows developer’s view by vetinari on Monday September 14, 2009 @08:05PM (#822915)
Yes, in the options field.
Re:Switching to Linux: A Windows developer’s view by jmillikin on Monday September 14, 2009 @04:00PM (#822492)
The X11 protocol was standardized in 1987. Any X application which worked then would work now. There are extensions and new capabilities being added, but every one is backwards-compatible.

Ditto with audio APIs -- the last major change was the changeover from OSS to ALSA, in 2002, and to this day there's an OSS compatibility layer.

I've used Linux since early 2001, and in all that time I've never encountered an incompatibility with libc.

The filesystem semantics issue is due to idiot application developers trying to squeeze out a few msec of performance, at the risk of their user's data. The issue exists on every modern filesystem, no matter which OS is used. Anybody who relies on POSIX -- ie, uses fsync() -- doesn't have to worry about that problem.

Re:Switching to Linux: A Windows developer’s view by modeless on Monday September 14, 2009 @05:56PM (#822695)
Yes, X11 is backwards compatible and that's been really great for the Linux desktop. But the article bashes Windows for rapidly introducing new APIs even though the old ones remain compatible; I'm just pointing out that Linux does that too.

As for the audio situation, the problem is sharing between multiple apps. ALSA sucks at it so "sound servers" were invented but they caused more problems than they solved. Now it seems like every distro has a different sound solution, and meanwhile OSS was never removed from the kernel so you can't even rely on ALSA always being there.

The filesystem problem can't be blamed wholly on apps or kernel devs; IMHO the problem really lies in POSIX which doesn't specify a way to achieve what app developers need in a way that can also be easily implemented in the kernel with good performance. I would argue that the behaviors app developers were using became a de facto part of POSIX and the way kernel devs broke them was irresponsible even if it didn't break the letter of the standard. Contrast with Microsoft which goes far, far out of its way to avoid breaking apps even when they flagrantly violate good practices (there are some great examples on The Old New Thing: http://blogs.msdn.com/oldnewthing/ ).

Re:Switching to Linux: A Windows developer’s view by jmillikin on Monday September 14, 2009 @06:12PM (#822717)
Yes, X11 is backwards compatible and that's been really great for the Linux desktop. But the article bashes Windows for rapidly introducing new APIs even though the old ones remain compatible; I'm just pointing out that Linux does that too.

Linux's graphics APIs have remained largely static: they are GTK+ and Qt. Nobody writes their own implementations of X11.

Your audio paragraph is completely divorced from reality. Sound servers were originally created to implement software mixing, which is not supported by OSS. When ALSA was imported into the mainline kernel, software mixing became possible without servers and they largely died out.

Now, ALSA is the dominant standard for Linux audio. Recently, the sound server PulseAudio was created, but apps use it through the standard ALSA API. To my knowledge, there is no distribution using a sound server other than Pulse.

You can't rely on sound being enabled, true. But every mainline distribution ships with sound enabled, and that means they support ALSA. If a user disables their sound subsystem and then complains they can no longer hear music, that's their problem.

The filesystem problem can't be blamed wholly on apps or kernel devs; IMHO the problem really lies in POSIX which doesn't specify a way to achieve what app developers need in a way that can also be easily implemented in the kernel with good performance.

Sure it does -- fsync(). To my knowledge, the only filesystem which has poor performance when using fsync() is ext3 in data=ordered mode (which is not the default).

Re:Switching to Linux: A Windows developer’s view by modeless on Monday September 14, 2009 @07:06PM (#822821)
When ALSA was imported into the mainline kernel, software mixing became possible without servers and they largely died out.

My experience was completely different. A few years ago, ALSA software mixing was not enabled by default and didn't work well when enabled. When not enabled, apps couldn't share the audio device at all. KDE created aRts to allow sharing at the app level, but aRts sucked, plus it hogged the audio device so non-aRts apps wouldn't work at all. Later aRts added a timeout after which it would release the device but this obviously wasn't a good solution. Gnome had ESD which I didn't use but it conflicted with aRts. JACK came along but was only ever used by high-end audio programs.

ALSA finally did get decent software mixing support, but now people are used to running sound servers. PulseAudio is the newest thing but last I heard a lot of people are still unsatisfied with it (e.g. http://jeffreystedfast.blogspot.com/2008/06/pulseaudio-solut... ). Furthermore, people who know what they're talking about are recommending a move away from PulseAudio and ALSA and back toward OSS! Personally, I think the case is quite convincing: http://insanecoding.blogspot.com/2009/06/state-of-sound-in-l...

To my knowledge, the only filesystem which has poor performance when using fsync() is ext3 in data=ordered mode (which is not the default).

Not according to http://lwn.net/Articles/351422/

Re:Switching to Linux: A Windows developer’s view by jmillikin on Monday September 14, 2009 @07:31PM (#822879)
A few years ago, ALSA software mixing was not enabled by default and didn't work well when enabled. When not enabled, apps couldn't share the audio device at all.

Yes, disabling sound mixing will prevent multiple applications from using the sound card at once, in much the same way as disabling graphics drivers will prevent X11 from working.

KDE created aRts to allow sharing at the app level, but aRts sucked, plus it hogged the audio device so non-aRts apps wouldn't work at all.

aRts is for pre-ALSA (ie OSS) applications. It doesn't belong on an ALSA-based system, and will obviously not get along well with a modern stack. I'm not denying there are lots of distributions which are configured poorly, but any decent distribution such as Red Hat or Debian worked well.

I disagree that glitch-free playback and per-application volumes are "solutions in search of problems", but that's personal taste. If somebody wants to run without PulseAudio, they can. Reading the blog post, it seems he was surprised when upgrading to a bleeding-edge development version caused problems.

The last link is written by an OSSv4 developer. OSSv4 is unlikely to ever gain mainstream acceptance because it contains insanity such as performing floating-point math in the kernel. Aside from people are literally hired from the company developing OSSv4, I have heard no good news about it, and there do not appear to be any movements back to an OSS-based stack.

Re:Switching to Linux: A Windows developer’s view by modeless on Tuesday September 15, 2009 @01:58AM (#823368)
Yes, disabling sound mixing will prevent multiple applications from using the sound card at once, in much the same way as disabling graphics drivers will prevent X11 from working.

X11 never came with graphics drivers disabled by default.

aRts is for pre-ALSA (ie OSS) applications.

aRts isn't "for" ALSA or OSS applications; in fact it doesn't play nice with either. aRts is for aRts applications. aRts has backends for both OSS and ALSA.

There's no reason glitch-free playback and per-application volume control can't be done in the kernel. The only feature that makes sense to do in user space is network transparency, which is of limited utility.

Re:Switching to Linux: A Windows developer’s view by nixx on Tuesday September 15, 2009 @04:51AM (#823509)
There's nothing wrong with floating-point math in the kernel (unless your CPU has no FPU!)

Arguably the best-performing audio driver API of the moment is CoreAudio (on Mac OS X) - and that uses floating point code in the kernel... ;-)

Re:Switching to Linux: A Windows developer’s view by pyre on Monday September 14, 2009 @07:35PM (#822886)
That first link you provided to people being 'unsatisfied with PulseAudio' is over a year old. Around a year ago most major distros jumped on PulseAudio a) before it was ready and b) using messed up configurations which didn't help anything.

I don't know much about how it stacks up for OSSv4, but I like the ability to see multiple audio streams from various programs and the ability to tweak a specific programs audio volume from PulseAudio (sometimes programs don't provide volume level control). I'm assuming here that everything talking about 'audio mixing' is just talking about taking multiple software audio outputs and blending them together to create the output to the hardware. Things like per-application/per-process audio volume control is an advanced feature that I've seen provided on OS X and I believe Windows (through 3rd party software). I would like to see functionality like this on Linux as well.

And to be fair, that blog post about going 'back to OSS' is claiming that OSSv3 -> OSSv4 was a major overhaul that adds in things like mixing support. When you say 'back to OSS', most people are going to read that as 'back to OSSv3' not 'ditch ALSA for the revamped OSSv4.'

Re:Switching to Linux: A Windows developer’s view by SwellJoe on Tuesday September 15, 2009 @03:15AM (#823442)
Ditto with audio APIs -- the last major change was the changeover from OSS to ALSA, in 2002, and to this day there's an OSS compatibility layer.

ALSA, as an API for building modern audio applications, is useless. Yes, literally, useless.

I have tried for over ten years to move my home studio recording to Linux-based tools...but, to this day, reliable, glitch-free, low-latency, multi-track 24 bit 96kHz audio from multiple applications and external sources is simply not possible under Linux (without dedicating a machine to the task, which I've never been willing to do, and which I don't have to do under Windows or Mac OS X).

First up, audio requires an rt kernel. The rt kernels trail behind the mainline kernel by several revisions, and usually include a few major security or stability issues. The latency of a non-rt kernel is such that even with extremely large buffers, audio still stutters.

You also need a sound server to permit multiple apps to share and route sound amongst other apps. The competing and barely compatible sound servers for Linux are targeted to different audiences, and generally don't do a very good job even for their specific niche. JACK is the professionals choice, but in my experience, it's never been stable enough to be usable for any real work. PulseAudio is laughably unreliable...it consistently fails when returning from sleep on my desktop, and makes weird popping noises after playing sounds on my laptop. It never worked at all on my mid-range audio devices (Delta 66 on the desktop and FireWire Focusrite Saffire LE on the lappy), as it seems to just freak out when there are multiple devices (to be fair, Vista also freaks out a bit when changing sound devices and using both for various tasks; I've been able to find a delicate balance that allows Flash and movies and such to play through the built-in audio and audio software to use the good devices).

Anyway, I use, and have used, Linux as my primary operating system for all of my machines for over ten years for everything except audio. I try to make the switch at least once a year, and I've failed every single time because of failures of both the kernel and the audio APIs on Linux. I'm not a neophyte at this stuff, either. I've written and maintained patches for the Linux kernel over the years, I'm not nervous about any of the required steps to make things work, it's just that when all is said and done, the system is either not capable of working with high quality audio at all (non-rt kernel, normal desktop PulseAudio configuration), but usable as a desktop system for normal work...or it's configured exactly right for pro audio (rt kernel, jackd, etc.), and sort of works for a few minutes or hours at a time, but is otherwise useless as a desktop system because 3D video drivers are too flaky in this configuration, kernel has stability or security issues, and normal software (like Firefox+Flash) can't talk to the jackd server and can't get access to the audio device because jack is holding it.

Music software that does happen to support Linux (Renoise, for an example of one of my favorite tools), there is confusion among the developers about what they should be doing to provide good support to Linux users...which of the several sound servers is the "right" one? It depends on who you ask.

So, while I spend 90% of my day running Linux, when I want to record music, I have to reboot into Windows.

Re:Switching to Linux: A Windows developer’s view by blasdel on Monday September 14, 2009 @05:20PM (#822645)
The reason application developers haven't been using fsync() is because it's ridiculously slow on ext.
Re:Switching to Linux: A Windows developer’s view by Periodic on Monday September 14, 2009 @02:26PM (#822265)
There are benefits and drawbacks to maintaining an API vs updating it. Switching every few months will alienate your developers, but making sure everything is 20 years backwards compatible will lead to strange errors (particularly because programmers will expect their idiosyncratic workarounds to continue to work)

I think the more important question is how the groups responsible will handle the transition. A well planned and executed transition will give many developers a chance to switch gradually and by the time the old API isn't supported the older versions of the program will likely only be run on the older versions of the API anyway.