dso.xml.ko revision a0e549fa035cea0147cb7700d1a814c8088676fd
<?xml version="1.0" encoding="EUC-KR" ?>
<!DOCTYPE manualpage SYSTEM "/style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="/style/manual.ko.xsl"?>
<!-- English Revision: 105989 -->
<!--
Copyright 2003-2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manualpage metafile="dso.xml.meta">
<title>���������ü (DSO) ����</title>
<summary>
<p>����ġ �������� ���ڰ� ������ �����Ͽ� ������ ������
����� ������ �� �ִ� ���ȭ�� ���α׷��̴�. ������ �����Ҷ�
<code>httpd</code> �������Ͽ� �������� ����� ��������
�� �ִ�. �ƴϸ� ����� <code>httpd</code> �������ϰ�
�и��Ͽ� ���������ü(Dynamic Shared Objects, DSO)�� ��������
�� �ִ�. DSO ����� ������ �������Ҷ� �������ϰų�, Apache
Extension Tool (<a href="programs/apxs.html">apxs</a>)��
����Ͽ� ���߿� �������Ͽ� �߰��� �� �ִ�.</p>
<p>�� ������ DSO ��� ����� ��� �̷��� �����Ѵ�.</p>
</summary>
<section id="implementation"><title>����</title>
<related>
<modulelist>
<module>mod_so</module>
</modulelist>
<directivelist>
<directive module="mod_so">LoadModule</directive>
</directivelist>
</related>
<p>����ġ �ٽɿ� �������� �������ؾ���
<module>mod_so.c</module>��� ����� ����ġ �����
�о���̱����� DSO�� �����Ѵ�.
�� ����� <module>core</module>�� �����ϰ� DSO��
�� �� ��� ������ ����̴�. ������ �ٸ� ��� ����ġ �����
<a href="install.html">��ġ ����</a>���� ������
<code>configure</code>�� <code>--enable-<em>module</em>=shared</code>
�ɼ��� ����Ͽ� DSO�� �������� �� �ִ�. �����
<code>mod_foo.so</code>�� ���� DSO�� ���������� <code>httpd.conf</code>
���Ͽ� <module>mod_so</module>��
<directive module="mod_so">LoadModule</directive> ��ɾ
����Ͽ� ���� ���۽� Ȥ�� ����۽� �� ����� �о���� ��
�ִ�.</p>
<p>����ġ ���(Ư�� �����ڰ� ���� ���)�� ����� DSO ������ ����
��������� <a href="programs/apxs.html">apxs</a> (<em>APache
eXtenSion</em>)��� ���ο� ���� ���α׷��� �ִ�. �� ���α׷���
����ġ �ҽ� Ʈ�� <em>�ۿ���</em> DSO�� ����� �����
�������Ҷ� ����Ѵ�. ������ ����. ����ġ�� ��ġ�Ҷ�
<code>configure</code>�� <code>make install</code>��
����ġ C ��������� ��ġ�ϰ�, DSO ������ �������ϱ�����
�÷��� Ư���� �����Ϸ� �ɼǰ� ��Ŀ �ɼ��� <code>apxs</code>
���α׷��� ����Ѵ�. �׷��� <code>apxs</code>�� ����ϴ� ����ڴ�
����ġ ������ �ҽ� Ʈ������, �� DSO ������ ���� �÷��� Ư����
�����Ϸ� �ɼǿ� ��Ŀ �ɼǿ� �Ű��� �����ʰ� �ڽ��� ����ġ
��� �ҽ��� �������� �� �ִ�.</p>
</section>
<section id="usage"><title>���� ���</title>
<p>Apache 2.0�� DSO ��ɿ� ���� ª�� ������ ����̴�:</p>
<ol>
<li>
<em>�������� �ִ�</em> ����ġ ����� �������ϰ� ��ġ�ϴ�
���. ���� ��� <code>mod_foo.c</code>�� DSO
<code>mod_foo.so</code>��:
<example>
$ /configure --prefix=/path/to/install --enable-foo=shared<br />
$ make install
</example>
</li>
<li>
<em>�����ڰ� ����</em> ����ġ ����� �������ϰ� ��ġ�ϴ�
���. ���� ��� <code>mod_foo.c</code>�� DSO
<code>mod_foo.so</code>��:
<example>
$ /configure --add-module=module_type:/path/to/3rdparty/mod_foo.c --enable-foo=shared<br />
$ make install
</example>
</li>
<li>
���� ����� <em>���߿� ����ϱ�����</em> ����ġ�� �����ϴ�
���:
<example>
$ /configure --enable-so<br />
$ make install
</example>
</li>
<li>
<em>�����ڰ� ����</em> ����ġ ����� �������ϰ� ��ġ�ϴ�
���. <a href="programs/apxs.html">apxs</a>�� ����Ͽ�
����ġ �ҽ� Ʈ�� <em>�ۿ���</em> <code>mod_foo.c</code>��
DSO <code>mod_foo.so</code>��:
<example>
$ cd /path/to/3rdparty<br />
$ apxs -c mod_foo.c<br />
$ apxs -i -a -n foo mod_foo.la
</example>
</li>
</ol>
<p>��� ��� �ϴ� ���� ����� �����ϵǸ�, <code>httpd.conf</code>��
<directive module="mod_so">LoadModule</directive> ���þ
����Ͽ� ����ġ�� �� ����� �о���̰� �����.</p>
</section>
<section id="background"><title>�������</title>
<p>�������� ���н���� <em>���������ü</em> (DSO)��
���� ��ŷ/�ε�(dynamic linking/loading)�̶�� �Ͽ�, Ư����
����� �����ڵ� ������ ����� �������� �������α׷���
�ּҰ� �о���̴� ���� ����� �ִ�.</p>
<p>���� �ΰ��� ������� �о���� �� �ִ�. �ϳ��� �������α׷���
�����Ҷ� <code>ld.so</code>��� �ý��� ���α׷��� �ڵ�����
�о���̴� ����, �ٸ� �ϳ��� �������� ���α׷���
<code>dlopen()/dlsym()</code> �ý���ȣ��� ���н� �δ�(loader)��
�ý��� �������̽��� ����Ͽ� ���� �о���̴� ����.</p>
<p>ù��° ��� DSO�� ���� <em>�������̺귯��(shared libraries)</em>
Ȥ�� <em>DSO ���̺귯��</em>��� �θ���, ������
<code>libfoo.so</code>�� <code>libfoo.so.1.2</code> ����
�̸��� �����. �̵��� �ý��� ���丮(���� <code>/usr/lib</code>)��
�ְ�, �����Ͻ� ��Ŀ ��ɾ <code>-lfoo</code>�� �־�
�������ϰ� �����Ѵ�. �̷��� ���� ���� ���̺귯���� �������Ͽ�
�����ǿ���, ���α׷��� �����Ҷ� ��Ŀ �ɼ� <code>-R</code>��
���� ������ ���, ȯ�溯�� <code>LD_LIBRARY_PATH</code>��
������ ��� Ȥ�� <code>/usr/lib</code>���� ���н� �δ���
<code>libfoo.so</code>�� ã�� �� �ִ�. �׷��� �������α׷���
(���� ��ã��(unresolved)) �ɺ�(symbol)�� DSO���� ã�Եȴ�.</p>
<p>DSO�� ���� �������α׷��� �ɺ��� ã���ʱ� ������ (DSO��
���밡���� �Ϲ����� �ڵ� ���̺귯���̹Ƿ�) ã��� ���⼭
������. ���н� �δ��� �ɺ� ã�⸦ ������ ����ϹǷ� �������α׷���
���� DSO���� �ɺ��� ã�� �ʿ䰡 ���. (��� <code>ld.so</code>��
�θ��� �ڵ�� ������ �ƴ� ��� �������α׷��� ��ũ�Ǵ� �����
�����ڵ��� �Ϻδ�.) ����� ���̺귯�� �ڵ带 �������� �о���̴�
������ ��Ȯ�ϴ�. ���̺귯�� �ڵ尡 ��� ���α׷��� �ߺ��ؼ�
����Ǵ� ��� <code>libc.so</code>�� ���� �ý��� ���̺귯����
�ѹ� ����DZ� ������ ��ũ ���� ���ȴ�.</p>
<p>�ι�° ��� DSO�� ���� <em>������ü(shared objects)</em>
Ȥ�� <em>DSO ����</em>�̶�� �θ���, (��Ģ�� �̸���
<code>foo.so</code>������) ������ Ȯ���ڴ� �����Ӵ�. ��
���ϵ��� ���� ���α׷� ��ü ���丮�� ��ġ�ϰ� �������α׷���
�ڵ����� ������� �ʴ´�. ��� �������α׷��� �����
<code>dlopen()</code>�� ����Ͽ� DSO�� �ּҰ�
���� �о�鿩�� �Ѵ�. �̶� �������α׷��� DSO���� �ɺ���
ã�� �ʴ´�. ��� �տ��� �� ���н� �δ��� �ڵ����� �������ϰ�
���������� �̹� �о���� DSO ���̺귯��(Ư�� �׻� �����ϴ�
<code>libc.so</code>�� ��� �ɺ�)���� DSO�� (���� ��ã��)
�ɺ��� ã�´�. �׷��� DSO�� ��ġ ó������ �������α׷���
�������� ��ũ�ȰͰ� ���� ���������� �ɺ��� �˰Եȴ�.</p>
<p>DSO�� API�� �̿��ϱ����ؼ� ���������� �������α׷���
<code>dlsym()</code>���� DSO���� Ư�� �ɺ��� ã�Ƽ�, ������
����ϱ����� ����ġ(dispatch) ǥ <em>��</em>�� �����Ѵ�.
�ٸ� ���� �������α׷��� ����� ��� �Ǻ��� ���� ã�ƾ��Ѵ�.
�̷� ������ ������ ���α׷��� �Ϻθ� ���α׷���
�ʿ��Ҷ����� �о������ �ʾƵ� (�׷��� �޸𸮸� ��������
�ʰ�) �ȴٴ� ���̴�. �⺻ ���α׷��� ����� Ȯ���ϱ�����
�ʿ��� ��� �� �κ��� �������� �о���� �� �ִ�.</p>
<p>�̷� DSO ������ �ڿ������� ��������, �ּ��� ����� ����
�Ѱ����ִ�. ���α׷��� Ȯ���ϱ����� DSO�� ����Ҷ� DSO��
�������α׷��� �ɺ��� ã�� ���̴�. ��? DSO�� �������α׷���
�ɺ��� "������ ã�� ��"�� (���̺귯���� �ڽ��� ����ϴ� ���α׷���
���� �𸥴ٴ�) ���̺귯�� ���迡 ���ϸ�, ��� �÷���
��������ʰ� ǥ��ȭ������ �ʾұ� �����̴�. ������ ����������
��ɺ�(global symbol)�� ���� �ͽ���Ʈ(export)���� �ʱ⶧����
DSO�� ����� �� ���. DSO�� ����Ͽ� ������ ���α׷��� Ȯ���Ϸ���
��Ŀ���� ��� ��ɺ��� �ͽ���Ʈ�ϵ��� �����ϴ� ���� �ֵ�
�ذ�å�̴�.</p>
<p>�������̺귯���� DSO ����� �����Ģ��� �������̱⶧����
�ü���� �����ϴ� ���� ��� ������ ���̺귯���� ����Ѵ�.
�ݴ�� ���� ���α׷��� ���α׷��� Ȯ���ϱ����� ������ü��
������� �ʴ´�.</p>
<p>1998�� ������ ������ ����� Ȯ���ϱ����� DSO ������ �����
����Ʈ���� ��Ű���� (XS ������ DynaLoader ����� �����)
Perl 5, Netscape Server <em>��</em>���� �幰���. ����ġ��
�̹� ����� Ȯ���ϱ����� ��� ������ ����߰� �ܺ� �����
����ġ �ٽɱ�ɿ� �����ϱ����� ���������� ����ġ�����
�̿��� ���ٹ���� ����߱⶧���� 1.3 ������� �� �뿭�� �շ��ߴ�.
�׷��� ����ġ�� ������ ����� �о���̴µ� DSO�� ����ϵ���
�����������.</p>
</section>
<section id="advantages"><title>�����</title>
<p>�տ��� ���� DSO�� ����ϸ� ������ ���� ������ �ִ�:</p>
<ul>
<li>���� ���� ���μ����� �����Ͻ� <code>configure</code>
�ɼǴ�� <code>httpd.conf</code>�� <directive
module="mod_so">LoadModule</directive>�� ����Ͽ� �����߿�
���յǹǷ� ���� ��Ű�� ������ �� �����ϴ�. ���� ��� �ѹ���
����ġ ��ġ������ �ٸ� ����(ǥ�� ����� SSL ����, �ּ�ȭ
����� ����߰� ���� [mod_perl, PHP3] <em>��</em>)�� ������
�� �ִ�.</li>
<li>������ ��ġ�Ŀ��� �����ڰ� ���� ����� ����Ͽ� ����
Ȯ���� �� �ִ�. �ּ��� ����� ��Ű�� �����ڴ� ����ġ �ٽ�
������ ������ PHP3, mod_perl, mod_fastcgi <em>��</em>��
�߰� ��Ű���� ���� �� �־ ū �̵��̴�.</li>
<li>DSO�� <code>apxs</code>�� ������ ����ġ �ҽ� Ʈ�� �ۿ���
�۾��ϰ� <code>apxs -i</code>�� <code>apachectl restart</code>
��ɾ���� ���� ������ ����� �� ������ �������� ����ġ
������ �ݿ��� �� �־ �� ���� ����ġ ����� ������ ��
�ִ�.</li>
</ul>
<p>DSO�� ������ ���� ������ �ִ�:</p>
<ul>
<li>���α׷��� �ּҰ� �ڵ带 �������� �о���̴� �����
���������ʴ� �ü���� �ֱ� ������ ��� �÷��� DSO��
����� �� ���.</li>
<li>���н� �δ��� �ɺ��� ã�ƾ��ϱ� ������ ���� ������
�� 20% ���� �ʾ����.</li>
<li>������ ��ġ�����ڵ�(position independent code, PIC)
������ ����ּ�����(absolute addressing)���� ����
����ּ�����(relative addressing)�� ������ ����? �����
�ʿ��ϹǷ� � �÷��� ����� �� 5% ���� �ʴ�.</li>
<li>DSO ����� �ٸ� DSO��� ���̺귯��(<code>ld -lfoo</code>)��
��ũ�� �� ��� �÷����� �ֱ⶧���� (���� ��� ELF���
�÷����� ���������� a.out��� �÷����� ���� �� �����
�������� �ʴ´�) ��� ������ ��⿡ DSO�� ����� �� ���.
�ٸ� ���� DSO ���Ϸ� �������ϴ� ����� ����ġ �ٽɰ� ����ġ
�ٽ��� ����ϴ� C ���̺귯��(<code>libc</code>)�� �ٸ�
����/���� ���̺귯��, ��ġ�����ڵ带 ��� �ִ� ���� ���̺귯��
��ī�̺�(<code>libfoo.a</code>)�� �ɺ����� ����� �� �ִ�.
�ٸ� �ڵ带 ����Ϸ��� ����ġ �ٽ��� �װ��� �����ϴ���,
<code>dlopen()</code>���� ���� �ڵ带 �о�鿩�� �Ѵ�.</li>
</ul>
</section>
</manualpage>