L9 Study Guide
T/F. A PRI of 0 is the most likely to get time slices on the CPU and a PRI of 127 is the least likely to receive time slices on the CPU.
T
T/F. All users can be "nice" to other users of the same computer by lowering the priority of their own processes. This can be done by increasing their nice value.
T
T/F. Although several Linux utilities can view processes, the most versatile and common is the ps command.
T
T/F. Be cautious about using SIGKILL because it prevents a process from closing temporary files and other resources properly.
T
T/F. Because the /etc/crontab file organizes tasks hourly, daily, weekly, and monthly, the user can copy a script file to the appropriate directory to schedule it using the system cron table.
T
T/F. However, only the root user has the ability to increase the priority of a process by lowering its nice value.
T
T/F. The root user can edit, list, or remove any other user's cron table by using the -u option to the crontab command followed by the user's name.
T
T/F. The six fields in the cron tables are separated by spaces or tab characters.
T
T/F. There are 64 different kill signals that affect the processes in different ways.
T
T/F. There are user and system cron tables.
T
T/F. To change the nice value to +15 for all processes owned by the users mary and bob, use renice +15 -u mary bob at the command prompt.
T
T/F. When a user saves the changes and quits the vi editor, the information is stored in the file /var/spool/cron/username where username is the name of the user who executed the crontab -e command.
T
T/F. When the ps command is used with the -f (full) option, it gives more complete information. In addition to the information given above, it also includes the user who started the process (UID), the PPID, the time it was started, as well as the CPU utilization.
T
A negative nice value ______ the likelihood that the process will receive more time slices, whereas a positive nice value does the opposite.
increases
Although the system administrator cannot change the PRI value directly, the nice (NI) value can be set to ______ affect the priority of a process.
indirectly
The first process started by the Linux kernel is the ___ daemon, which has a PID of 1 and a PPID of 0 referring to the kernel itself.
init
The ____ command lists all background processes running in the current shell.
jobs
When there are multiple background processes executing in the shell, the ______ command indicates the most recent background processes with a + symbol and the second most recent background processes with a - symbol. Commands operate on the most recent process, by default.
jobs
Without arguments, the ___ command simply displays a list of processes that are running in the current shell. It includes the PID, terminal, CPU time and the command that started the process.
ps
The ___ command can be used to change the PRI or to kill processes. The user can stop rogue processes immediately after they are identified since they appear at the top of this list for this command.
top
The ___ command displays an interactive screen listing processes organized by processor time. Processes that use the most processor time are listed at the top of the screen.
top
The ______ is a file listing all of the users that are able to use the at command.
/etc/at.allow
T/F. Regular users see only their own scheduled jobs.
T
T/F. To create or edit a user cron table, you can use the -e option with the crontab command which opens the vi editor.
T
T/F. To send a kill signal to a process, give the kill signal to send as an option to the kill command, followed by the appropriate PID of the process.
T
T/F. Use the -l option with the ps command to observe the process state.
T
The ______ command removes a cron table and all scheduled jobs.
crontab -r
3. Where are individual user tasks scheduled to run with the cron daemon stored? a. /etc/crontab b. /etc/cron/(the user's login name) c. /var/spool/cron d. /var/spool/cron/(the user's login name)
d. /var/spool/cron/(the user's login name)
______ is an act of creating a new BASH shell and it is carried out with the fork function in the BASH shell. This new subshell then executes the binary program or shell script using its exec function. The original BASH shell waits for the subshell to complete. The subshell kills itself when it is done and then control returns to the original BASH shell.
Forking
The ______ command is used to delete a scheduled job.
at -d
The ______ command is used to run scheduled jobs from a shell script.
at -f
The _____ command is used to view a list of scheduled jobs.
at -l
Every process has a unique ______ that allows the kernel to identify it uniquely.
process ID (PID)
The ___ indicates what the process is currently doing. Most processes are either sleeping (S) or running (R).
process state
The ___ command displays the lineage of a process by tracing its PPIDs until the init daemon.
pstree
A ___ is a faulty process that consumes an excessive amount of system resources.
rogue process
The ______ command will alter the NI of a process after it is running.
renice
When a process finished executing, the parent process must check to see if it executed correctly and then release the child process's PID so it can be used again. While a process is waiting for its parent process to release the PID, the process is said to be in a ___ state, because it has finished but retains a PID.
zombie
The ______ is a file listing all of the users that are not able to use the at command.
/etc/at.deny
The ______ file lists all of the users that are able to use the cron command.
/etc/cron.allow
The ______ file lists all of the users that are not able to access the cron command.
/etc/cron.deny
The system cron tables contain system tasks and exist in the ______ file as well as in the /etc/cron.d directory.
/etc/crontab
The at daemon uses the current shell's environment when executing scheduled commands. The shell environment and scheduled commands are stored in the ______ directory.
/var/spool/at
The user cron tables exist in ______ and represent tasks that individual users schedule.
/var/spool/cron
By default, a process starts with a NI value of ______.
0
______ processes are processes that the BASH shell does not wait for termination. It uses the & metacharacter as part of the command and the user receives the BASH shell prompt immediately.
Background
There are three main types of Linux commands that may be executed. State them.
Binary programs (ls, find and grep are examples) Shell scripts Shell functions (cd and exit are examples)
______ are configuration files specifying tasks for the cron daemon to run. In the cron tables, the commands to be executed should be specified.
Cron tables
15. To kill a process running in the background, you must place a % character before its process ID. True or False?
False
______ processes are processes that the BASH shell must wait for termination.
Foreground
The only kill signal that cannot be trapped by any process is the ______.
SIGKILL (9)
T/F. Any program that can read from the /proc directory can display process information.
T
T/F. It is often necessary to kill a parent process in order to kill zombie processes.
T
T/F. The cron daemon will run myscript in the root directory at 5:20 p.m. and 5:40 p.m., Monday through Friday.
T
T/F. The entries in the system cron table (/etc/crontab) specify these tasks and the times that they will be executed. It can only be edited by the root user.
T
T/F. The init daemon then starts most other daemons, including those that allow for user logins.
T
T/F. The initial section of the cron table specifies the environment used while executing commands.
T
T/F. The kernel exports all process information subdirectories under the /proc directory.
T
T/F. The more time slices a process has, the more time it has to execute on the CPU and the faster the process is executed. Time slices are typically measured in milliseconds.
T
There are two different daemons used to schedule commands. State them.
the at daemon (atd) & the cron daemon (crond)
A ______ is an amount of time a process has to use the CPU on a multiprocessing operating system.
time slice
T/F. On a newly installed Red Hat Fedora Linux system, all users have the ability to schedule tasks using the cron daemon because there is only a blank line within the /etc/cron.deny file.
T`
6. As daemon processes are not associated with terminals, you must use the -e switch with the ps command to view them. True or False?
True
4. Which process will always have a PID of 1 and a PPID of 0? a. the kernel itself b. ps c. init d. top
c. init
7. Which of the following commands will most likely increase the chance of a process receiving more time slices? a. renice 0 b. renice 15 c. renice -12 d. renice 19
c. renice -12
9. The at command is used to _______________. a. schedule processes to run periodically in the background b. schedule processes to run periodically on a recurring basis in the future c. schedule processes to run at a single instance in the future d. schedule processes to run in the foreground
c. schedule processes to run at a single instance in the future
19. Which command is used to gain real-time information about processes running on the system with the most processor-intensive processes listed at the beginning of the list? a. ps b. ps -elf c. top d. top -l
c. top
Each process can start an unlimited number of other processes. These new processes are called ______.
child processes
System maintenance, backups, and CPU-intensive tasks are often scheduled during non-business hours and are often scheduled by the ______ daemon.
cron
The ______ daemon is a system daemon that executes tasks repetitively in the future.
cron
The PRI is ______ related to the amount of time slices a process has on the CPU.
directly
10. What command is used to view and modify user jobs scheduled to run with cron? a. crontab b. cron c. ps d. sched
a. crontab
The ______ utility can also be used to change the NI value of running processes. The root user needs to press the r key, the PID & the nice value when prompted.
top
A _____________is a process begun by a user on a terminal.
user process
ps -ef | grep bash
This command only displays on the screen the processes that involve the bash shell. See page 396 for the output from this command.
ps ax | head -11
No dash is referred to as a Berkeley style option. The a option lists all processes across terminals while the x option list processes that do not run on a terminal.
As a result, each process has a ___ which identifies the process that started it.
Parent process ID (PPID)
A ______ is a program that is running in memory and on the CPU.
Process
___ is the priority used by the kernel for the process. It is measured between 0 (high priority) and 127 (low priority).
Process priority (PRI)
A ______ is an executable file on the hard disk that can be run when you execute it.
Program
T/F. If both files exist, the system checks the /etc/at.allow file and does not process the entries in the /etc/at.deny file.
T
T/F. If both files exist, the system checks the /etc/cron.allow file and does not process the entries in the /etc/cron.deny file.
T
T/F. If kill signals are sent to processes that have children, then the parent process terminates all of its child processes before terminating itself.
T
T/F. If the /etc/at.allow and /etc/at.deny files do not exist, only the root user is allowed to schedule tasks using the at daemon.
T
T/F. If the standard output (stdout) of any command scheduled using atd has not been redirected to a file, it is mailed to the user. Type mail to see your messages.
T
T/F. If you do not specify the kill signal when using the kill command, the kill command uses the default kill signal which is SIGTERM (15).
T
T/F. In addition, the top command can be used to kill processes. Simply press the k key and supply the appropriate PID and kill signal when prompted.
T
T/F. On Fedora Linux systems, only an /etc/at.deny file exists by default. It is initially left blank, hence all users are allowed to use the at daemon.
T
T/F. On a busy Linux server, zombie processes can accumulate and prevent new processes from being created. If this occurs, you can simply kill the parent process of the zombies.
T
T/F. Only the root user may change NI to a negative value using the renice command.
T
T/F. Some processes have the ability to ignore, or trap, certain kill signals that are sent to them.
T
T/F. The at command schedules commands and tasks to run once in the future at a preset time.
T
T/F. The atq command is a shortcut to the at -l command and is an alternative method to view scheduled jobs.
T
T/F. The ps -l command lists the Linux kernel priority (PRI) of a process.
T
T/F. The ps command is not the only command that can display process information.
T
T/F. The remainder of the file contains comments that identify the format of a system cron table entry.
T
16. What kill level signal cannot be trapped? a. 1 b. 9 c. 3 d. 15
b. 9
18. When you run the ps command, how are daemon processes recognized? a. The terminal is listed as tty0. b. There is a question mark in the TTY column. c. There is an asterisk in the STIME column. d. There is a "d" for daemon in the terminal identification column.
b. There is a question mark in the TTY column.
5. The term used to describe a process spawning or initiating another process is referred to as_____. a. a child process b. forking c. branching d. parenting
b. forking
20. Which command can be used to see processes running in the background? a. bg b. jobs c. ps -% d. fg
b. jobs
A foreground process can be paused with Ctrl+z combination and sent to the background with the ______ command.
background (bg)
The ______ command lists a user's cron table.
crontab -l
8. How can you bypass the wait function and send a user process to the background? a. This cannot happen once a process is executing; it can be done only when the command is started by placing an ampersand (&) after it. b. This cannot happen; only daemon processes can run in the background. c. You can use the ps command. d. You can use the Ctrl+z key combination and the bg command.
d. You can use the Ctrl+z key combination and the bg command.
14. What is the name given to a process not associated with a terminal? a. child process b. parent process c. user process d. daemon process
d. daemon process
17. A runaway process that is faulty and consuming mass amounts of system resources ________. a. is a zombie process b. is an orphaned process c. has a PPID of Z d. is a rogue process
d. is a rogue process
11. Every process has a process ID and a_______. a. fork process b. daemon c. child process d. parent process ID
d. parent process ID
1. Which command entered without arguments is used to display a list of processes running in the current shell? a. ppid b. list c. pid d. ps
d. ps
A ______ is a system process that is not associated with a terminal.
daemon process
After a background process has been started, the ______ command moves this background process to the foreground.
foreground (fg)
A ___ command is the most common command used to terminate a process. It sends a kill signal to the process.
kill
The ______ command kills all instances of a process by the command name. It uses the process name instead of its PID. This is convenient for killing multiple processes with the same name.
killall
The ______ command changes a process's priority as it starts.
nice
The ___ can be used to affect the process priority indirectly. It is measured between - 20 (a greater chance of a high priority) and 19 (a greater chance of a lower priority).
nice value (NI)
Each process must be started by an existing process. This existing process is called a ______.
parent process
2. Which of the following statements is true? (Choose all that apply.) a. If /etc/at.allow exists, only users listed in it can use the at command. b. If /etc/cron.allow exists, only users listed in it can use the cron command. c. If /etc/cron.deny exists and /etc/cron.allow does not exist, any user not listed in /etc/cron.deny can use the cron command. d. If /etc/cron.allow and /etc/cron.deny exist, only users listed in the former can use the cron command and any listed in the latter are denied access to the cron command. e. If a user is listed in both /etc/cron.allow and /etc/cron.deny, then /etc/cron.deny takes precedence and the user cannot access the crontab command.
a. If /etc/at.allow exists, only users listed in it can use the at command. b. If /etc/cron.allow exists, only users listed in it can use the cron command. c. If /etc/cron.deny exists and /etc/cron.allow does not exist, any user not listed in /etc/cron.deny can use the cron command.
The ______ daemon is a system daemon that executes tasks once at a future time.
at
The ______ command is used to view the contents of the shell environment at the time the at job was scheduled.
at -c
13. Nice values are used to affect process priorities using a range between _____________. a. 0 and 20 b. 0 and -19 c. -19 and 20 d. -20 and 19
d. -20 and 19
12. The killall command terminates _________. a. all instances of a process with the same PPID b. all instances of a process with the same PID c. all instances of a process with the same priority d. all instances of a process with the same name
d. all instances of a process with the same name