Drift Diary XV

Sudden Termination

Posted by drikin on 2009年9月21日 23:27

Sudden termination

Have you ever wandered why Snow Leopard's system logout and shutdown is dramatically faster than Leopard? @m_koke told me "Sudden Termination" that is one of Snow Leopard feature today.

Apple introduced the new APIs to NSProcessInfo class at Snow Leopard. It can obviously declare whether the application can kill suddenly or not for the system.

There is official document here.

It seems a bit disorderly but, personally, I don't dislike this type of facility. Actually almost Apple's default applications are supported it and It obviously improve the performance of logout and shutdown.

At first, Spirited Away support Sudden Termination a bit while before. Please try to update it if you are using it.

P.S. Since Snow Leopard's activity monitor, You can see whether Sudden Termination is enable or not if you check View→Columns→Sudden Termination from that menu.


なんで、Snow Leopardでシステム終了やログアウトが劇的に早くなったか不思議じゃないですか?

その謎は、今日@m_kokeさんから、教えてもらったSudden Terminationにありました。

Sudden Terminationは、Snow LeopardでNSProcessInfoに加わった新しいAPIなんですが、アプリ開発者が、自分のアプリケーションをシステムに対して、このアプリは、終了/ログアウト時に、強制終了しても良いかを明示できるAPIです。ここで、強制終了可を宣言しておくと、終了/ログアウト時に、そのアプリケーションは、終了コールバックもなく、突然killされることで、終了時間を稼いでます。

この手のシステムは、ロジカルじゃないような気もしますが、個人的には嫌いじゃないです。成熟してきたシステムで、この手の、ちょっとした、(ローテクとも思える?)仕組みを入れると、劇的に効果が得られることも多々あります。今回Snow LeopardでAppleは、パフォーマンス向上のためには形振りかまわず最適化してきたって感じですかね。

オフィシャルドキュメントはこちら

とりあえず、自作アプリもSpirited Awayから対応してみました。

あ、ちなみに、Snow Leopardのアクティビティモニタでは、表示→表示項目→即時終了をチェックすると、このSudden Terminationのサポート状況をチェックすることが出来ます。

このエントリーをはてなブックマークに追加
comments powered by Disqus