|
251 | 251 | that switches the context to different process. The downside of cooperative |
252 | 252 | planning is that one process can block the CPU and other processes forever. |
253 | 253 | \item Unix uses only preemptive planning for user processes. |
| 254 | +\item There is also a \emph{tickless kernel} that uses a variable timer tick. |
254 | 255 | \item Traditional (historical) UNIX \emsl{kernel} uses cooperative planning, |
255 | 256 | i.e. process running in kernel mode is not switched until it gives up the CPU |
256 | 257 | by itself. |
|
472 | 473 | runs in foreground (\emph{foreground process group}) and has access to the |
473 | 474 | controlling terminal for input and output, the rest is running in the background |
474 | 475 | (\emph{background process groups}) and have only optional access to the output |
475 | | -or no at all. (disallowed operation with terminal will stop the process). |
| 476 | +or no at all. |
| 477 | + |
| 478 | +A disallowed operation with a terminal will stop the process. To verify, start |
| 479 | +a process in the background, for example a simple shell script that does |
| 480 | +\texttt{read a}. On the next shell prompt, you will be notified by the shell |
| 481 | +that the process was stopped (you can set your shell to notify you about such |
| 482 | +events asynchronously -- if you know what you are doing). The process was |
| 483 | +actually stopped by signal \texttt{SIGTTIN}. How to verify that? Run |
| 484 | +\texttt{strace -o output ./the-script \&} and check the output file. |
| 485 | + |
476 | 486 | \item[parent process:] Each process (besides \texttt{swapper}, |
477 | 487 | \texttt{pid~==~0}) |
478 | 488 | has a parent, i.e. process that created it with the \texttt{fork} syscall. |
|
700 | 710 | ... |
701 | 711 | \end{verbatim} |
702 | 712 |
|
| 713 | +Example: \example{exec/execl-buggy.c} |
703 | 714 | \end{itemize} |
704 | 715 |
|
705 | 716 | %%%%% |
|
897 | 908 | \begin{itemize} |
898 | 909 | \item creates an unnamed pipe and allocates a pair of file descriptors |
899 | 910 | \begin{itemize} |
900 | | - \item \texttt{fildes[0]} \dots{} reading from a pipe |
901 | | - \item \texttt{fildes[1]} \dots{} writing to a pipe |
| 911 | + \item \texttt{fildes[0]} \dots{} for reading from a pipe |
| 912 | + \item \texttt{fildes[1]} \dots{} for writing to a pipe |
902 | 913 | \end{itemize} |
903 | 914 | \item the system makes sure that: |
904 | 915 | \begin{itemize} |
|
0 commit comments