From owner-doc-jp@jp.freebsd.org  Tue May  8 03:00:14 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id DAA29281;
	Tue, 8 May 2001 03:00:14 +0900 (JST)
	(envelope-from owner-doc-jp@jp.FreeBSD.org)
Received: from mercury.ikeno.org (z211-19-83-249.dialup.wakwak.ne.jp [211.19.83.249])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id DAA29276
	for <doc-jp@jp.freebsd.org>; Tue, 8 May 2001 03:00:11 +0900 (JST)
	(envelope-from nao@mc.kcom.ne.jp)
Received: from localhost (localhost [127.0.0.1])
	by mercury.ikeno.org (8.11.3/8.11.3) with ESMTP id f47I02x91314;
	Tue, 8 May 2001 03:00:02 +0900 (JST)
	(envelope-from nao@mc.kcom.ne.jp)
To: nao@mc.kcom.ne.jp
Cc: doc-jp@jp.freebsd.org
In-Reply-To: <20010505161043W.nao@mc.kcom.ne.jp>
References: <20010505.041103.104025248.hrs@eos.ocn.ne.jp>
	<20010505161043W.nao@mc.kcom.ne.jp>
X-Mailer: Mew version 1.94.1 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA)
Mime-Version: 1.0
Content-Type: Multipart/Mixed;
 boundary="--Next_Part(Tue_May__8_01:48:59_2001_809)--"
Content-Transfer-Encoding: 7bit
Message-Id: <20010508014901O.nao@mc.kcom.ne.jp>
Date: Tue, 08 May 2001 01:49:01 +0900
From: IKENO Naoki <nao@mc.kcom.ne.jp>
X-Dispatcher: imput version 20000228(IM140)
Lines: 153
Reply-To: doc-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+010328
X-Sequence: doc-jp 8196
Subject: [doc-jp 8196] Re: book.3j.sgml =?ISO-2022-JP?B?GyRCPSQbKEI=?=
 =?ISO-2022-JP?B?GyRCQDUbKEI=?= 
Errors-To: owner-doc-jp@jp.freebsd.org
Sender: owner-doc-jp@jp.freebsd.org
X-Originator: nao@mc.kcom.ne.jp

----Next_Part(Tue_May__8_01:48:59_2001_809)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit


 $B$3$s$P$s$O!"CSLn$G$9!#(B

 $B$3$,$h$&$$$A$m$&$5$s!"F|Ln$5$s!"(Breview $B$r$7$FD:$-$"$j$,$H$&$4$6$$$^$7$?!#(B

 $B$*FsJ}$K=$@5$7$F$$$?$@$$$?J,$H!":4F#$5$s$N=q$+$l$?%k!<%k$r(B
 $BE,MQ$7$?=$@5HG$rAw$j$^$9!#(B
-----
IKENO Naoki
Mail: nao@mc.kcom.ne.jp



----Next_Part(Tue_May__8_01:48:59_2001_809)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="book.3j.sgml"

    <sect1>
      <title>Kernel Services</title>
      <title>$B%+!<%M%k(B $B%5!<%S%9(B</title>
      
      <para>The boundary between the kernel- and user-level code is enforced by
	hardware-protection facilities provided by the underlying hardware.
        $B%+!<%M%k%l%Y%k%3!<%I$H%f!<%6%l%Y%k%3!<%I$N4V$N6-3&$O(B, 
        $B4pHW$H$J$k%O!<%I%&%'%"$GDs6!$5$l$k%O!<%I%&%'%"%l%Y%k$NJ]8n5!G=$K$h$C$F(B
        $B6/@)$5$l$F$$$^$9(B.

	The kernel operates in a separate address space that is inaccessible to
	user processes.
	Privileged operations -- such as starting I/O
	and halting the central processing unit
	(CPU) --
	are available to only the kernel.
        $B%+!<%M%k$O(B, $B%f!<%6%W%m%;%9$K$H$C$F%"%/%;%9$7$K$/$$@Z$jN%$5$l$?(B
        $B%"%I%l%96u4V$G:nF0$7$^$9(B. $BFC8"$N$"$kA`:n(B -- $B$?$H$($P(B
        I/O $B$N3+;O$dCf1{=hM}AuCV(B (CPU) $B$NDd;_(B --
        $B$O(B, $B%+!<%M%k$@$1$,MxMQ2DG=$G$9(B.

	Applications request services from the kernel with
	<emphasis>system calls</emphasis>
	System calls are used to cause the kernel to execute complicated
	operations, such as writing data to secondary storage,
	and simple operations, such as returning the current time of day.
        $B%"%W%j%1!<%7%g%s$O(B<emphasis>$B%7%9%F%`%3!<%k(B</emphasis>$B$rMQ$$$F%+!<%M%k$K(B
        $B%5!<%S%9$rMW5a$7$^$9(B. $B%7%9%F%`%3!<%k$OFs<!5-21AuCV$K%G!<%?$r(B
        $B=q$-9~$`$h$&$JJ#;($J:n6H$d(B, $B8=:_$NF|;~$rJV$9$h$&$JC1=c$J:n6H$r(B
        $B%+!<%M%k$K<B9T$5$;$k$?$a$K;HMQ$5$l$^$9(B. 

	All system calls appear
	<emphasis>synchronous</emphasis>
	to applications:
	The application does not run while the kernel does the actions associated
	with a system call.
        $B$9$Y$F$N%7%9%F%`%3!<%k$O%"%W%j%1!<%7%g%s$H(B<emphasis>$BF14|$7$F(B</emphasis>
        $BEP>l$7$^$9(B. $B%"%W%j%1!<%7%g%s$O%+!<%M%k$,%7%9%F%`%3!<%k$K4XO"$7$?(B
        $BF0:n$r$7$F$$$k$H$-$K$O<B9T$5$l$^$;$s(B.
	
        The kernel may finish some operations associated with a system call
	after it has returned.
        $B%+!<%M%k$O%7%9%F%`%3!<%k$,La$C$?8e(B, $B$=$l$K4X$9$k$$$/$D$+$N:n6H$r(B
        $B=*N;$9$k$+$b$7$l$^$;$s(B.
	
        For example, a
	<emphasis>write</emphasis>
	system call will copy the data to be written
	from the user process to a kernel buffer while the process waits,
	but will usually return from the system call
	before the kernel buffer is written to the disk.
        $B$?$H$($P(B, <emphasis>wirte</emphasis> $B%7%9%F%`%3!<%k$O(B, $B%W%m%;%9$,(B
        $BBT$C$F$$$k4V$K(B, $B=q$-9~$_$5$l$k%G!<%?$r%f!<%6%W%m%;%9$+$i(B
        $B%+!<%M%k%P%C%U%!$K%3%T!<$7$h$&$H$7$^$9$,(B, $BBgDq%+!<%M%k%P%C%U%!$,(B
        $B%G%#%9%/$K=q$-9~$^$l$kA0$K%7%9%F%`%3!<%k$+$iLa$C$F$/$k$G$7$g$&(B.
</para>
      
      <para>A system call usually is implemented as a hardware trap that changes the
	CPU's
	execution mode and the current address-space mapping.
        $BDL>o%7%9%F%`%3!<%k$O(B, CPU $B$N<B9T%b!<%I$*$h$S8=:_$N%"%I%l%96u4V(B
        $B%^%C%T%s%0$rJQ99$9$k%O!<%I%&%'%"%H%i%C%W$H$7$F<BAu$5$l$F$$$^$9(B.

	Parameters supplied by users in system calls are validated by the kernel	before being used.
        $B%f!<%6$K$h$C$FM?$($i$l$?%7%9%F%`%3!<%kCf$N%Q%i%a!<%?$O(B, 
        $B;HMQ$5$l$kA0$K%+!<%M%k$K$h$C$F8!>Z$5$l$^$9(B.

	Such checking ensures the integrity of the system.
        $B$=$N$h$&$J%A%'%C%/$O%7%9%F%`$N40A4@-$rJ]>Z$7$^$9(B.

	All parameters passed into the kernel are copied into the
	kernel's address space,
	to ensure that validated parameters are not changed
	as a side effect of the system call.
        $B%+!<%M%k$XEO$5$l$?%Q%i%a!<%?$O$9$Y$F(B, $B%7%9%F%`%3!<%k$NI{:nMQ$H$7$F(B
        $B8!>Z$5$l$?%Q%i%a!<%?$,JQ99$5$l$J$$$3$H$rJ]>Z$9$k$?$a$K%+!<%M%k$N(B
        $B%"%I%l%96u4V$K%3%T!<$5$l$^$9(B.

	System-call results are returned by the kernel,
	either in hardware registers or by their values
	being copied to user-specified memory addresses.
        $B%7%9%F%`%3!<%k$N7k2L$O(B, $B%+!<%M%k$K$h$C$F%O!<%I%&%'%"%l%8%9%?Cf$K(B
        $BJV$5$l$k$+(B, $B$"$k$$$O%f!<%6$,;XDj$7$?%a%b%j%"%I%l%9$K%3%T!<$5$l$kCM$G(B
        $BJV$5$l$^$9(B.

	Like parameters passed into the kernel,
	addresses used for
	the return of results must be validated to ensure that they are
	part of an application's address space.
        $B%+!<%M%k$XEO$5$l$?%Q%i%a!<%?$N$h$&$K(B, $B7k2L$rLa$9$?$a$K%"%W%j%1!<%7%g%s(B
        $B$K$h$C$F;XDj$5$l$?%"%I%l%9$O$=$l$i$,%"%W%j%1!<%7%g%s$N%"%I%l%96u4V$N(B
        $B0lIt$G$"$k$3$H$r3N<B$K$9$k$?$a$K8!>Z$5$l$J$1$l$P$J$j$^$;$s(B.

	If the kernel encounters an error while processing a system call,
	it returns an error code to the user.
        $B%7%9%F%`%3!<%k$r=hM}$9$k4V$K%+!<%M%k$,%(%i!<$KAx6x$7$?>l9g(B, $B%+!<%M%k$O(B
        $B%f!<%6$K%(%i!<%3!<%I$rJV$7$^$9(B.

	For the
	C programming language, this error code
	is stored in the global variable
	<emphasis>errno</emphasis>,
	and the function that executed the system call returns the value -1.
        C $B%W%m%0%i%_%s%08@8l$K$*$$$F$O(B, $B$3$N%(%i!<%3!<%I$,Bg0hJQ?t(B
        <emphasis>errno</emphasis>$B$K3JG<$5$l$^$9(B. $B$^$?(B, $B%7%9%F%`%3!<%k$r(B
        $B<B9T$7$?4X?t$O(B -1 $B$NCM$rJV$7$^$9(B.</para>

      <para>User applications and the kernel operate
	independently of each other.
        $B%f!<%6%"%W%j%1!<%7%g%s$H%+!<%M%k$O(B, $B8_$$$KL54X78$KF0:n$7$^$9(B.

	4.4BSD does not store I/O control blocks or other
	operating-system-related
	data structures in the application's address space.
        4.4BSD $B$O%"%W%j%1!<%7%g%s$N%"%I%l%96u4V$K(B I/O $B%3%s%H%m!<%k%V%m%C%/(B
        $B$"$k$$$O%*%Z%l!<%F%#%s%0%7%9%F%`$K4XO"$9$kB>$N%G!<%?9=B$$r3JG<$7$^$;$s(B.

	Each user-level application is provided an independent address space in
	which it executes.
        $B%f!<%6%l%Y%k$N3F%"%W%j%1!<%7%g%s$O(B, $B$=$l$r<B9T$9$k$?$aFH<+$N(B
        $B%"%I%l%96u4V$rDs6!$5$l$^$9(B.

	The kernel makes most state changes,
	such as suspending a process while another is running,
	invisible to the processes involved.</para>
        $BJL$N%W%m%;%9$,Av$C$F$$$k4V(B, $B%W%m%;%9$rDd;_$5$;(B, $B4X78$9$k%W%m%;%9$K(B
	$B8+$($J$$$h$&$K$9$k(B, $B$H$$$&$h$&$JB?$/$N>uBV$NJQ99$r%+!<%M%k$O$7$F$$$^$9(B.</para>
    </sect1>


----Next_Part(Tue_May__8_01:48:59_2001_809)----
