mikeash.com: just this guy, you know?

NSBlog
"A failure in the hot air department"
RSS feed (full text feed) - Show Tag Cloud
Showing entries tagged "threading". Full blog index.

by Mike AshTags: fridayqna swift threading
Back in the dark ages of Swift 1, I wrote an article about locks and thread safety in Swift. The march of time has made it fairly obsolete, and reader Seth Willits suggested I update it for the modern age, so here it is!

by Mike AshTags: fridayqna objectivec threading
The Objective-C runtime is at the heart of much Mac and iOS code. At the heart of the runtime is the objc_msgSend function, and the heart of that is the method cache. Today I'm going to explore how Apple manages resizing and deallocating method cache memory in a thread safe manner without impacting performance, using a technique you probably won't find in textbooks discussing thread safety.

by Mike AshTags: fridayqna letsbuild threading swift
Continuing the theme of thread safety from the previous article, today I'm going to explore an implementation of Objective-C's @synchronized facility in the latest edition of Let's Build. I'm going to build it in Swift, although an equivalent Objective-C version would be much the same.

by Mike AshTags: fridayqna swift threading
An interesting aspect of Swift is that there's nothing in the language related to threading, and more specifically to mutexes/locks. Even Objective-C has @synchronized and atomic properties. Fortunately, most of the power is in the platform APIs which are easily used from Swift. Today I'm going to explore the use of those APIs and the transition from Objective-C, a topic suggested by Cameron Pulsford.

by Mike AshTags: fridayqna gcd threading atomic
Reader Paul Kim pointed out an entry on Michael Tsai's blog about making dispatch_once fast. While the comment in the dispatch_once source code is fascinating and informative, it doesn't quite delve into the detail that some would like to see. Since this is one of my favorite hacks, for today's article I'm going to discuss exactly what's going on there and how it all works.

by Mike AshTags: objectivec threading evil
Every once in a while, when writing threaded code, you may find yourself wanting to acquire two different locks in a critical section. Normally one should resist such perversions, but sometimes they just end up being necessary, or too tempting. Holding multiple locks at the same time immediately raises the specter of deadlock: if two threads acquire the same locks in a different order, they can end up waiting on each other forever.

by Mike AshTags: fridayqna fork process posix safety threading
It's once again time to dive into bizarre programming arcana. In today's article, I want to look at the details of fork-safe code, why the restrictions are present, and why you might care, a topic suggested by Ben Mitchell.

by Mike AshTags: fridayqna threading atomic
It's time for another crazy edition of Friday Q&A. Today, Paul Kim has suggested that I give a tour of OSAtomic, OS X's built-in low-level functions for lockless thread-safe operations. Given the announcement Wednesday of the dual-core iPad 2, this was a particularly prescient suggestion on his part.

by Mike AshTags: fridayqna objectivec accessors threading memory
It's once again time for a brand new edition of Friday Q&A. This week, I'm going to talk about accessors, and how to properly deal with memory management and thread safety when creating them, a topic suggested by Daniel Jalkut.

by Mike AshTags: cocoa threading dangerous
It's another Friday, and so time for another Friday Q&A. This week, Quentin Carnicelli (one of the guys who signs my paychecks) suggested that I talk about dangerous API calls in Cocoa.

by Mike AshTags: fridayqna chemicalburn performance threading
Welcome to another Friday Q&A, where all the women are strong, all the men are good-looking, and all the programmers are above average. This week, Phil Holland has suggested that I dissect an interesting piece of code from one of my screensavers, so we're going to take a look at ChemicalBurn's multithreaded routing code.

Friday Q&A 2009-01-09 at 2009-01-09 21:38
by Mike AshTags: fridayqna threading cocoa
Greetings one and all. I caught my mistaken writing of "2008" in this blog post title almost instantly instead of only noticing after I'd already posted it like I did last week, so the year must be coming along. Welcome to the second Friday Q&A of 2009 (and only the fourth in all human history!) where I'll be taking Ed Wynne's suggestion and talking about the various meanings and implications of thread safety as they apply to Mac OS X system frameworks.

Friday Q&A 2008-12-19 at 2008-12-20 01:28
by Mike AshTags: fridayqna threading parallelism performance
Great response last week. This week I'm going to merge Sam McDonald's question about how I got into doing multithreaded programming and Phil Holland's idea of talking about the different sorts of parallelism available.

Late Night Cocoa at 2008-09-05 23:31
by Mike AshTags: interview link atomic threading
Readers of this blog may be interested in my recent appearance on Late Night Cocoa. I discussed the fundamental principles and basic concepts behind lockless thread-safe data structures. You can access the episode here.
Hosted at DigitalOcean.