|
52 | 52 |
|
53 | 53 | %%%%% |
54 | 54 |
|
55 | | -\pdfbookmark[1]{typical layout of directories}{hier} |
| 55 | +\pdfbookmark[1]{typical layout of system directories}{hier} |
56 | 56 |
|
57 | 57 | \begin{slide} |
58 | | -\sltitle{Typická skladba adresářů} |
| 58 | +\sltitle{Typical layout of system directories} |
59 | 59 | \begin{tabular}{l@{\hspace{3ex}\dots\hspace{3ex}}l} |
60 | | -\texttt{/bin} & základní systémové příkazy\\ |
61 | | -\texttt{/dev} & speciální soubory (zařízení, devices)\\ |
62 | | -\texttt{/etc} & konfigurační adresář\\ |
63 | | -\texttt{/lib} & základní systémové knihovny\\ |
64 | | -\texttt{/tmp} & veřejný adresář pro dočasné soubory\\ |
65 | | -\texttt{/home} & kořen domovských adresářů\\ |
66 | | -\texttt{/var/adm} & administrativní soubory (ne na BSD) \\ |
67 | | -\texttt{/usr/in{}clude} & hlavičkové soubory pro C\\ |
68 | | -\texttt{/usr/local} & lokálně instalovaný software\\ |
69 | | -\texttt{/usr/man} & manuálové stránky\\ |
70 | | -\texttt{/var/spool} & spool (pošta, tisk,...) |
| 60 | +\texttt{/bin} & basic system commands\\ |
| 61 | +\texttt{/dev} & devices\\ |
| 62 | +\texttt{/etc} & configuration\\ |
| 63 | +\texttt{/lib} & basic system libraries\\ |
| 64 | +\texttt{/tmp} & public directory for temporary files\\ |
| 65 | +\texttt{/home} & root of home directories\\ |
| 66 | +\texttt{/var/adm} & administrative files (not on BSD) \\ |
| 67 | +\texttt{/usr/in{}clude} & header files for C\\ |
| 68 | +\texttt{/usr/local} & locally installed software\\ |
| 69 | +\texttt{/usr/man} & man pages\\ |
| 70 | +\texttt{/var/spool} & spool (mail, printing,...) |
71 | 71 | \end{tabular} |
72 | 72 | \end{slide} |
73 | 73 |
|
74 | 74 | \begin{itemize} |
75 | | -\item v \texttt{/bin}, \texttt{/lib}, \texttt{/sbin} jsou příkazy a knihovny |
76 | | -potřebné při startu systému, kdy je připojen pouze kořenový filesystém. Ostatní |
77 | | -příkazy a knihovny jsou typicky v \texttt{/usr/bin}, \texttt{/usr/lib} a |
78 | | -\texttt{/usr/sbin}. \texttt{/usr} bývá často samostatný filesystém, čímž jeho |
79 | | -obsah není dostupný během startu systému. |
80 | | -\item \texttt{s} v \texttt{sbin} značí ,,system'', ne SUID. Jsou to binárky, u |
81 | | -kterých se předpokládá, že je běžný uživatel nebude typicky potřebovat. |
82 | | -\item podstrom \texttt{/usr} obsahuje soubory, které se nemění při běžném |
83 | | -provozu a nejsou závislé na konkrétním počítači. Proto by měl jít sdílet |
84 | | -read-only. Na své stanici doma ho ale většinou budete mít read-write. |
85 | | -\item \texttt{/lib} typicky obsahuje knihovny potřebné pro programy z kořenového |
86 | | -svazku. Pokud by všechny knihovny byly v \texttt{/usr/lib} a \texttt{/usr} byl |
87 | | -samostatný svazek, problém s připojením \texttt{/usr} by kompletně ochromil celý |
88 | | -systém, protože by nešlo spustit nic. Někdy to systémy řeší tak, že kořenový |
89 | | -svazek obsahuje sadu základních programů, které jsou staticky slinkované. |
90 | | -Například FreeBSD má takové binárky v adresáři \texttt{/rescue}, má ale i |
91 | | -samostatné adresáře \texttt{/lib} a \texttt{/usr/lib}. |
92 | | -\item v podstromu \texttt{/var} jsou data, která se za provozu mění a jsou |
93 | | -specifická pro každý počítač. |
94 | | -\item různé systémy i instalace jednoho systému se často liší. |
95 | | -\item \texttt{hier(7)} na FreeBSD a Linuxu popisuje adresářovou hierarchii |
96 | | -tohoto systému, Solaris má \texttt{filesystem(5)}. |
| 75 | +\item The \texttt{/bin}, \texttt{/lib}, \texttt{/sbin} directories contain |
| 76 | +commands and libraries needed for the start of the system when only root |
| 77 | +filesystem is mounted. The rest of the commands is located typically in |
| 78 | +\texttt{/usr/bin}, \texttt{/usr/lib} and \texttt{/usr/sbin}. |
| 79 | +\texttt{/usr} may be a separate file system, possibly not accessible during |
| 80 | +system startup. |
| 81 | +\item The \texttt{s} letter in \texttt{sbin} means ,,system'', not SUID. |
| 82 | +It contain binaries not needed by typical user. |
| 83 | +\item The \texttt{/usr} directory tree contains files that are not changing |
| 84 | +while the system is running and are not dependent on given machine. |
| 85 | +This property should make it elegible for read-only sharing. On your own |
| 86 | +machine it will be typically read-write, though. |
| 87 | +\item The \texttt{/lib} directory typically contains libraries needed for |
| 88 | +programs from the root file system. If all libraries were in \texttt{/usr/lib} |
| 89 | +and \texttt{/usr} was separate file system, a problem with mounting |
| 90 | +\texttt{/usr} could paralyze complete system, because no program could be run. |
| 91 | +In some systems the root file system contains base set of programs that are |
| 92 | +statically linked. For example FreeBSD has such binaries under the |
| 93 | +\texttt{/rescue} directories. It also has separate directories \texttt{/lib} and |
| 94 | +\texttt{/usr/lib}. |
| 95 | +\item The \texttt{/var} directory tree contains data that change while the |
| 96 | +system is running and are specific for given machine. |
| 97 | +\item There can be differences in directory layout found between installations |
| 98 | +of the same operating system. |
| 99 | +\item The \texttt{hier(7)} manual page on FreeBSD and Linuxu describes directory |
| 100 | +hierarchy on these systems. Solaris uses \texttt{filesystem(5)}. |
97 | 101 | \end{itemize} |
98 | 102 |
|
99 | 103 | %%%%% |
100 | 104 |
|
101 | 105 | \begin{slide} |
102 | | -\sltitle{Přístup k periferním zařízením} |
| 106 | +\sltitle{Peripheral device access} |
103 | 107 | \begin{itemize} |
104 | | -\item adresář \texttt{/dev} obsahuje speciální soubory zařízení. |
105 | | -Proces otevře speciální soubor systémovým voláním \texttt{open()} a |
106 | | -dále komunikuje se zařízením pomocí volání \texttt{read()}, |
107 | | -\texttt{write()}, \texttt{ioctl()}, apod. |
108 | | -\item speciální soubory se dělí na |
| 108 | +\item The \texttt{/dev} directory contains special device files. |
| 109 | +A process opens special file via \texttt{open()} and communicates with the |
| 110 | +device via \texttt{read()}, \texttt{write()}, \texttt{ioctl()}, etc. |
| 111 | +\item special files are divided into: |
109 | 112 | \begin{itemize2} |
110 | | - \item \emsl{znakové} \dots{} data se přenáší přímo mezi procesem a |
111 | | - ovladačem zařízení, např. sériové porty |
112 | | - \item \emsl{blokové} \dots{} data prochází systémovou |
113 | | - vyrovnávací pamětí (buffer cache) po blocích pevně dané |
114 | | - velikosti, např. disky |
| 113 | + \item \emsl{character} \dots{} data is transferred directly between process |
| 114 | + and device driver, e.g. serial ports |
| 115 | + \item \emsl{block} \dots{} data is passed through system cache |
| 116 | + (buffer cache) in blocks of given size, e.g. disks |
115 | 117 | \end{itemize2} |
116 | | -\item speciální soubor identifikuje zařízení dvěma čísly |
| 118 | +\item special device identifies concrete device with two numbers |
117 | 119 | \begin{itemize2} |
118 | | - \item \emsl{hlavní (major) číslo} \dots{} číslo ovladače v jádru |
119 | | - \item \emsl{vedlejší (minor) číslo} \dots{} číslo v rámci |
120 | | - jednoho ovladače |
| 120 | + \item \emsl{major} \dots{} number of device driver in the kernel |
| 121 | + \item \emsl{minor} \dots{} number within single device driver |
121 | 122 | \end{itemize2} |
122 | 123 | \end{itemize} |
123 | 124 | \end{slide} |
124 | 125 |
|
125 | 126 | \begin{itemize} |
126 | | -\item vyrovnávací paměti (cache) urychlují periferní operace. Při čtení se data |
127 | | -hledají nejprve v~bufferu. Teprve když nejsou k dispozici, tak se čtou z disku. |
128 | | -Při příštím čtení stejného bloku jsou data v bufferu. Při zápisu se data uloží |
129 | | -do bufferu. Na disk je systém přepíše později. Lze si vynutit i okamžitý zápis |
130 | | -dat na disk. Dnes již cache typicky není samostatná struktura, vše je zastřešeno |
131 | | -modulem vitruální paměti. |
132 | | -\item disky v UNIXu jsou obvykle přístupné přes znakové (používané při |
133 | | -\texttt{mkfs} -- vytvoření svazku -- a \texttt{fsck} -- kontrola konzistence) i |
134 | | -blokové rozhraní (používané při normálním provozu systému souborů). Některé |
135 | | -systémy (FreeBSD) ale už v \texttt{/dev} vůbec soubory pro bloková zařízení |
136 | | -nemají, pouze znaková. |
137 | | -\item dříve musel administrátor systému po změně hardwarové konfigurace upravit |
138 | | -obsah adresáře \texttt{/dev} skriptem \texttt{MAKEDEV} nebo ručně. Dnes (Linux, |
139 | | -IRIX, Free\-BSD, Solaris, \dots) již speciální soubory dynamicky vznikají a |
140 | | -zanikají podle toho, jak jádro detekuje přidání nebo odebrání hardwarových |
141 | | -komponent (viz \emph{devfs} na straně \pageref{DEVFS}). |
142 | | -\item okamžitý zápis na disk lze vynutit přes \texttt{O\_DIRECT} command ve |
143 | | -volání \texttt{fcntl}. |
| 127 | +\item The cache speeds up operations with peripheral devices. When reading the |
| 128 | +data is searched in the buffer first. When not present there, they are being |
| 129 | +read from disk. For the next read they are already available in the buffer. |
| 130 | +For writing the data is stored into a buffer that is written to the disk later. |
| 131 | +It is possible to force immediate write to disk. In today's systems the cache is |
| 132 | +not a standalone structure, rather it is part of virtual memory system. |
| 133 | +\item Disks in Unix are usually accessible using both character and block |
| 134 | +interface. The former is used by \texttt{mkfs} when creating the file system and |
| 135 | +also by \texttt{fsck} when performing file system consistency check. |
| 136 | +The latter is used for normal reads and writes. Some systems (FreeBSD) do not |
| 137 | +have block devices under \texttt{/dev}. |
| 138 | +\item In the past, the contents of the \texttt{/dev} directory had to be |
| 139 | +refreshed by a shell script (\texttt{MAKEDEV}) or by hand whenever hardware |
| 140 | +configuration changed. Today most of the systems populate the directory on the |
| 141 | +fly as kernel detects addition or removal of hardware components |
| 142 | +(see \emph{devfs} on page \pageref{DEVFS}). |
| 143 | +\item Immediate write to disk can be forced by using the \texttt{O\_DIRECT} |
| 144 | +command via the \texttt{fcntl} system call. |
144 | 145 | \end{itemize} |
145 | 146 |
|
146 | 147 | %%%%% |
|
0 commit comments