Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uva
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
uva
Commits
5a8d4c9f
Commit
5a8d4c9f
authored
14 years ago
by
Sander Mathijs van Veen
Browse files
Options
Downloads
Patches
Plain Diff
Continued with introduction of OS assignment 3.
parent
9efab91b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
os/ass3/report/report.tex
+16
-4
16 additions, 4 deletions
os/ass3/report/report.tex
with
16 additions
and
4 deletions
os/ass3/report/report.tex
+
16
−
4
View file @
5a8d4c9f
...
...
@@ -36,6 +36,8 @@ breaklines=false
\begin{document}
\definecolor
{
darkgray
}{
rgb
}{
0.95,0.95,0.95
}
\maketitle
\tableofcontents
...
...
@@ -61,9 +63,9 @@ procesboom. De meest gebruikte manier om een nieuwe process te starten is:
terug van het aangemaakte kindproces. In de taal C zou dat er zo uit
kunnen zien:
\begin{lstlisting}
[numbers=none]
\begin{lstlisting}
[numbers=none
,backgroundcolor=
\color
{
darkgray
}
]
if( (cpid = fork()) < 0 )
perror("
F
ork() failure");
perror("
f
ork() failure");
else if( cpid == 0 )
child
_
process();
else
...
...
@@ -113,13 +115,23 @@ digraph pipe {
}
\end{dot2tex}
Een unidirectionele pipe wordt in POSIX-compatible besturingssystemen met
\texttt
{
pipe()
}
aangemaakt. Dat geeft een array van file descriptors terug die
naar de uiteinden van de pipe gaan. In de meeste gevallen zal het ouderproces
schrijven naar het kindprocess en dan sluit het ouderproces
\texttt
{
pipefd[0]
}
en het kindproces sluit
\texttt
{
pipefd[1]
}
met
\texttt
{
close()
}
. Vervolgens
schrijft het ouderproces data met
\texttt
{
write()
}
naar
\texttt
{
pipefd[1]
}
en
het kindproces leest dan met
\texttt
{
read()
}
de data uit
\texttt
{
pipefd[0]
}
.
Als het kindproces data naar het ouderproces wil sturen, draaien
\texttt
{
0
}
en
\texttt
{
1
}
van de file descriptors om.
Ook is er een functie, genaamd
\texttt
{
mkfifo()
}
, die het mogelijk maakt om
een pipe aan het bestandsysteem te koppelen. Hiermee kunnen twee processen
communiceren door de output/input te schrijven naar een ``bestand''. Dit bestand
wordt niet op de hardeschijf opgeslagen, maar enkel aan het bestandssysteem
gekoppeld. Voorbeeld van een named pipe:
\begin{lstlisting}
[numbers=none]
\begin{lstlisting}
[numbers=none
,backgroundcolor=
\color
{
darkgray
}
]
mkfifo --mode=0666 /tmp/sql
_
dump
gzip --stdout -d file.gz > /tmp/sql
_
dump
\end{lstlisting}
...
...
@@ -127,7 +139,7 @@ gzip --stdout -d file.gz > /tmp/sql_dump
\noindent
en dan kan er in bijvoorbeeld MySQL gelezen worden door:
\begin{lstlisting}
[numbers=none]
\begin{lstlisting}
[numbers=none
,backgroundcolor=
\color
{
darkgray
}
]
LOAD DATA INFILE '/tmp/sql
_
dump' INTO TABLE table
_
name;
\end{lstlisting}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment