356 lines
5.5 KiB
HTML
356 lines
5.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Exercises</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
|
REL="HOME"
|
|
TITLE="Introduction to Linux"
|
|
HREF="index.html"><LINK
|
|
REL="UP"
|
|
TITLE="Processes"
|
|
HREF="chap_04.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Summary"
|
|
HREF="sect_04_05.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="I/O redirection"
|
|
HREF="chap_05.html"></HEAD
|
|
><BODY
|
|
CLASS="sect1"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
SUMMARY="Header navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>Introduction to Linux: </TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="sect_04_05.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
>Chapter 4. Processes</TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="chap_05.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="sect1"
|
|
><H1
|
|
CLASS="sect1"
|
|
><A
|
|
NAME="sect_04_06"
|
|
></A
|
|
>4.6. Exercises</H1
|
|
><P
|
|
>These are some exercises that will help you get the feel for processes running on your system.</P
|
|
><DIV
|
|
CLASS="sect2"
|
|
><H2
|
|
CLASS="sect2"
|
|
><A
|
|
NAME="AEN6058"
|
|
></A
|
|
>4.6.1. General</H2
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Run <B
|
|
CLASS="command"
|
|
>top</B
|
|
> in one terminal while you do the exercises in another.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Run the <B
|
|
CLASS="command"
|
|
>ps</B
|
|
> command.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Read the man pages to find out how to display all your processes.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Run the command <B
|
|
CLASS="command"
|
|
>find <TT
|
|
CLASS="filename"
|
|
>/</TT
|
|
></B
|
|
>. What effect does it have on system load? Stop this command.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>In graphical mode, start the <B
|
|
CLASS="command"
|
|
>xclock</B
|
|
> program in the foreground. Then let it run in the background. Stop the program using the <B
|
|
CLASS="command"
|
|
>kill</B
|
|
> command.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Run the <B
|
|
CLASS="command"
|
|
>xcalc</B
|
|
> directly in the background, so that the prompt of the issuing terminal is released.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>What does <B
|
|
CLASS="command"
|
|
>kill <TT
|
|
CLASS="option"
|
|
>-9 -1</TT
|
|
></B
|
|
> do?</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Open two terminals or terminal windows again and use <B
|
|
CLASS="command"
|
|
>write</B
|
|
> to send a message from one to the other.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Issue the <B
|
|
CLASS="command"
|
|
>dmesg</B
|
|
> command. What does it tell?</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>How long does it take to execute <B
|
|
CLASS="command"
|
|
>ls</B
|
|
> in the current directory?</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Based on process entries in <TT
|
|
CLASS="filename"
|
|
>/proc</TT
|
|
>, owned by your UID, how would you work to find out which processes these actually represent?</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>How long has your system been running?</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Which is your current TTY?</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Name 3 processes that couldn't have had <B
|
|
CLASS="command"
|
|
>init</B
|
|
> as an initial parent.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Name 3 commands which use SUID mode. Explain why this is so.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Name the commands that are generally causing the highest load on your system.</P
|
|
></LI
|
|
></UL
|
|
></DIV
|
|
><DIV
|
|
CLASS="sect2"
|
|
><H2
|
|
CLASS="sect2"
|
|
><A
|
|
NAME="AEN6107"
|
|
></A
|
|
>4.6.2. Booting, init etc.</H2
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Can you reboot the system as a normal user? Why is that?</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>According to your current run level, name the steps that are taken during shutdown.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>How do you change the system run level? Switch from your default run level to run level 1 and vice versa.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Make a list of all the services and daemons that are started up when your system has booted.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Which kernel is currently load at startup?</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Suppose you have to start some exotic server at boot time. Up until now, you logged in after booting the system and started this server manually using a script named <TT
|
|
CLASS="filename"
|
|
>deliver_pizza</TT
|
|
> in your home directory. What do you have to do in order to have the service start up automatically in run level 4, which you defined for this purpose only?</P
|
|
></LI
|
|
></UL
|
|
></DIV
|
|
><DIV
|
|
CLASS="sect2"
|
|
><H2
|
|
CLASS="sect2"
|
|
><A
|
|
NAME="AEN6123"
|
|
></A
|
|
>4.6.3. Scheduling</H2
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>Use <B
|
|
CLASS="command"
|
|
>sleep</B
|
|
> to create a reminder that your pasta is ready in ten minutes.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Create an <B
|
|
CLASS="command"
|
|
>at</B
|
|
> job that copies all files in your home directory to <TT
|
|
CLASS="filename"
|
|
>/var/tmp</TT
|
|
> within half an hour. You may want to create a sub-directory in <TT
|
|
CLASS="filename"
|
|
>/var/tmp</TT
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Make a cronjob that does this task every Monday to Friday during lunch.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Check that it works.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Make a mistake in the crontab entry, like issuing the nonexistent command <B
|
|
CLASS="command"
|
|
>coppy</B
|
|
> instead of <B
|
|
CLASS="command"
|
|
>cp</B
|
|
>. What happens upon execution of the task?</P
|
|
></LI
|
|
></UL
|
|
></DIV
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
SUMMARY="Footer navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="sect_04_05.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
ACCESSKEY="H"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="chap_05.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Summary</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="chap_04.html"
|
|
ACCESSKEY="U"
|
|
>Up</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>I/O redirection</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |