John Siracusa's in-depth review of Snow Leopard on Ars Technica
arstechnica.com
arstechnica.com
What I find interesting is what he chooses to cover and not cover- The review is 23 pages, which is quite a codex, but choices had to be made.. There is a page dedicated to the specifics of GCD's C interface, but only a paragraph about the revised Services design.
In all, I think that Ars does a wonderful job with these reviews, and like 10.6 itself, a lot of the depth is built on top of previous (excellent) releases. For example, we know that John thinks the hybrid finder, which is neither Spacial or truly a file browser, is a strange beast, and he's linked to his epic discussions about the finder in the past. In this review, all that is needed is discussing the changes that bring us into SL, and the review does that well.
I've joked to my friends before that sometimes I'm more excited about the Ars review of a new release than I am about actually installing it, and the new version delivers as promised.
Snow Leopard looks to be doing a great job in laying the foundation for the next few years of OSX- It's interesting to watch how the relationship between the iPhone and Mac code continues to evolve.
Wow, I'm glad to learn I wasn't the only guy doing that.
I am surprised he didn't cover the changes to the Services menu. I feel like it's one of the biggest obvious changes to Snow Leopard. I doubt many people used, or even understood, what the Services menu was in previous versions. It's now an incredibly useful context sensitve feature that appears to be extensible through Automator. This could be the biggest stealth UI paradigm shift in SL. My only gripe is discoverability. Apple did a great job fixing this feature but people who are used to ignoring it will continue to do so. Something simple like an icon next to the menu entry might have caused people to give it another glance.
Overall this is a fantastic review. I am a little disappointed that 10.7 came out around page 13. I'll never catch up now.
http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.a... and http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.a...
Edit: you've gotta get excited when you see examples like this
before:
for (i = 0; i < count; i++) {
results[i] = do_work(data, i);
}
total = summarize(results, count);
after: dispatch_apply(count, dispatch_get_global_queue(0, 0), ^(size_t i) {
results[i] = do_work(data, i);
});
total = summarize(results, count);
And there you have it: a for loop replaced with a concurrency-enabled equivalent with one line of code. No preparation, no additional variables, no impossible decisions about the optimal number of threads, no extra work required to wait for all the independent tests to complete. (The dispatch_apply() call will not return until all the tasks it has dispatched have completed.) Stunning.Basically a threadpool as any other, but managed by the OS - not you.
Results = lists:map(DoWork, data)
by Results = pmap(DoWork, data)
with `pmap` being implemented with 15 lines of Erlang.Does your Erlang example take into account the overall work the entire OS is doing on each individual processor core, adjusting the number of threads as the amount of overall work changes — or does it just take the Erlang-program's own work into account?
No. That's a side effect and benefit. The whole point of GCD is that it's trivial to use, therefore making it easy to benefit from multicore machines.
> Does your Erlang example take into account the overall work the entire OS is doing on each individual processor core, adjusting the number of threads as the amount of overall work changes — or does it just take the Erlang-program's own work into account?
In the erlang view of the world, the erlang runtime is the OS. And within that context, Erlang takes in account the overall work of itself (in fact, it more precisely doesn't give a damn: it spawns a scheduler thread per logical core -- or more or less if you ask it to -- and then dynamically maps Erlang processes on these OS threads the way GCD dispatches queued tasks to its threadpool).
While Erlangers may view the Erlang environment as the universe, it decidedly isn't, as it runs on an OS that does other things as well. Your Erlang example, while I'm sure it's really great for you and other Erlangers, simply doesn't do what GCD does.
That's very debatable, but thank goodness it wasn't my point in the first place. My point was simply to do what cubicle67's example demonstrates, namely (in his words)
> And there you have it: a for loop replaced with a concurrency-enabled equivalent with one line of code. No preparation, no additional variables, no impossible decisions about the optimal number of threads, no extra work required to wait for all the independent tests to complete. (The dispatch_apply() call will not return until all the tasks it has dispatched have completed.) Stunning.
That's very precisely what the Erlang example does.
Of course, if that sort of thing was a core design goal from the outset it damned well should be more elegant! It's much harder to bolt closures on to C, and a bit of syntactic elegance had to be traded off to make it happen, no doubt. I'd say they did a fine job given the constraints. My favorite touch: they chose a glyph for the block pointer that was actually pointy: ^
I don't want to detract from Erlang, because you were right to highlight what it does so well...but it's nice to see these ideas make it into the C foundation of a mass-market operating system in a manner that is both central and grand, even if the syntax isn't quite as tight.
Absolutely. And I find the syntax pretty tight anyway.
But with GCD, it has the knowledge of the number of cores and running threads and processes so it can allocate the whole system's resources much better.
The other thing I like is how well it is integrated with other new features like blocks, OpenCL and Clang. I expect to see something similar on Linux soon, or (wishful thinking) if the GCD interface was ported to other unices so we could write portable multicore application in a sane way.
http://arstechnica.com/apple/reviews/2000/10/macos-x-beta.ar...
http://arstechnica.com/apple/reviews/2001/04/macos-x.ars
http://arstechnica.com/apple/reviews/2001/10/macosx-10-1.ars
http://arstechnica.com/apple/reviews/2002/09/macosx-10-2.ars
http://arstechnica.com/apple/reviews/2003/11/macosx-10-3.ars
http://arstechnica.com/apple/reviews/2005/04/macosx-10-4.ars
http://arstechnica.com/apple/reviews/2007/10/mac-os-x-10-5.a...
Is it because he used bit.ly? (I'm not being snarky, just curious)
Might be. I hadn't seen his comment yet when I posted mine (was just scrolling down) and just wanted to point the previous reviews to huygen (I'd kinda missed they were on the last page and he'd already got the links through the article itself).
- (IBAction)analyzeDocument:(NSButton *)sender
{
dispatch_async(dispatch_get_global_queue(0, 0), ^{
NSDictionary *stats = [myDoc analyze];
dispatch_async(dispatch_get_main_queue(), ^{
[myModel setDict:stats];
[myStatsView setNeedsDisplay:YES];
[stats release];
});
});
}
It takes a potentially long running operation, analyze, and put it on a background thread. Once it's done, the UI is updated on the main thread. GCD made that ridiculously easy, but, this is assuming that the objects reference from your block are thread-safe.It may be that the analyze method isn't thread safe, and mutates some state inside the myDoc object. So it made one part of creating async/multi-threaded apps easier, but you still need to be careful with mutating state like that.
Yes. I believe many Mac developers attempting to leverage GCD are going to get a long-overdue wakeup call regarding their extremely prevalent use of mutable state.
Although someone does point out in the comments that he has left out the initial release of Tiger/x86, which was arguably a 0-features follow-on to Tiger/PPC. That would have changed the shape of the curve. The choice is completely arbitrary.
http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.a...
I love Ars; a lot of 'em are here in Chicago, but man, this shit can get out of hand. At least they do the summary themselves on the last page.