作成日:2004.04.12 更新日:2006.02.19 更新記録 (2004.04.12) 3/6、 3/11、 3/13 の日記をまとめて作成。 (2004.05.07) 文章を修正。サンプルコードを追加。 (2005.01.20) alternative → alterante に修正。 (2005.02.13) 追記を記述。 (2006.02.17) linux_stack_info.cpp の実装に誤りがあったので修正。 (2006.02.19) BSD 系OS でのスタック領域情報の取得の仕方を追加 初めに C/C++ でプログラムをしているとつい忘れてしまうのがスレッドのスタックオーバーフローの問題。 最近の OS はスレッド当たり 2〜8MB のスタック領域を持っているため、よほどのことがない限りスタックが溢れてしまうことはない。 だが、再帰や alloca を積極的に使
分散KVS kumofs のコードは、全体で約2万行です*1。 そのうち、ネットワークI/Oやプロトコルに関するコードは約1万行*2で、全体の約半分を占めています。 ロジックは残りの半分*3だけで実装されています。 この実例から分かりますが、kumofsのような分散アプリケーションを開発するにはI/O周りの実装が大変で、とてつもなく大きな障壁になっています。*4 さらに今日では、性能を稼ぐためにマルチスレッド化が必須です。また、多数のクライアントを少ないリソースで効率よく相手にするには、非同期・イベント駆動型のアーキテクチャも必要になります。さらに、究極的な性能を達成すべく GC を利用しない C++ においては、実装のみならず設計も大変です。 これに加えてソケットAPIの難解な挙動に対処にしなければならないため、C言語やC++によるネットワークプログラミングは、vimの使いこなしなどと同
はじめに Google から、非常に面白そうなソフトウェアがリリースされました! その名も Native Client なんとブラウザ上で X86 のバイナリを動かしてしまうそうです。 これはすごい! さっそく試してみたいと思います。その過程を逐次更新していきます。 自分が試したときの環境 自分が試す環境は、以下の通りです。 Mac OS X Xcode の gcc (version 4.0.1 (Apple Inc. build 5465)) python 2.5.1 準備 では、さっそく準備をしましょう。 http://nativeclient.googlecode.com/svn/trunk/nacl/googleclient/native_client/documentation/getting_started.html を参考にやってみます。 環境一式をダウンロード まずは、以下
C の関数呼び出しは、関数定義の型と互換性のない型として呼び出したら未定義動作です。例えば以下のコードの動作は未定義です。 #include <stdio.h> int main(void) { ((int (*)(char *, ...)) &printf)("Hello, world!\n"); } printf は int printf(const char *, ...) なので、const が無くなってるのが間違ってます。未定義のプログラムはどのような実行結果になろうとも、C の規格には違反しません。 でも、現実問題としてこのコードは期待通りに動くだろー、と高をくくってました。しかし最近の gcc (3.4 以降くらい) では、このコードは落ちます。 $ gcc --version gcc (GCC) 4.3.1 Copyright (C) 2008 Free Software
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く