This set of Unix Problems focuses on “Process Management – 2”.
1. We can list the jobs queued using at command by using ____ option.
Explanation: Jobs scheduled using at command are sent to a queue for later execution. To list the jobs in this queue we can use the -l option with at command. This command will list each of the scheduled jobs in the queue in this format.
1 Thur Jan 17 12:08:00 2018-01-20
2. To remove a job from the queue, which option is used with at command?
Explanation: Jobs can be listed using -l option with at command and can be removed using -r option. All we have to do is to provide the job number (of the job which we want to remove from the queue) as an argument to at command along with -r option. For example,
$ at -r 1 // removes job 1 from the queue.
3. We cannot find out the name of the program scheduled using at command.
Explanation: Unfortunately, the major drawback in at command is that we cannot find out the name of the program scheduled to be executed. This may create a problem when we are unable to recall whether a specific job has actually been scheduled for later execution.
4. Which command permits to schedule jobs for later execution, as soon as the system load permits?
Explanation: The batch command also allows us to schedule jobs for later execution but unlike at command, it executes the jobs as soon as the system load permits. For example,
$ batch < emp.sh
Commands will be executed using usr/bin/bash
Job 1016171818.a at Sun Jan 15 16:07:00 2018
This command doesn’t take any arguments but uses an internal algorithm to determine the execution time.
5. Jobs scheduled using batch command goes to a special at queue.
Explanation: The batch command also allows us to schedule jobs for later execution but unlike at command, it executes the jobs as soon as the system load permits. Any job scheduled using batch goes to a special at queue.
6. Jobs scheduled using batch command can be removed using ___ option.
Explanation: Any job scheduled using batch goes to a special at queue. To remove a job from this queue we can use the -r option with at command. For example,
$ at -r 1 // removes job 1 from the queue.
7. What is a daemon?
a) process whose parent has died
b) process who has completed its execution but still has an entry in the process table
c) process which is running infinitely
d) process which runs automatically without any user interaction
Explanation: Daemons are processes which run automatically without requiring any user interaction. These are designed to help the user by performing tasks which are commonly done. For example, checking for an e-mail.
8. What is cron?
a) a simple process
b) an orphan process
c) a daemon
d) a zombie process
Explanation: cron is a daemon which runs on UNIX systems. It executes programs at regular intervals. It lets us to schedule jobs so that they can be scheduled repeatedly. It executes cron jobs created by the crontab. For example, a cron job can be scheduled for processing logs every evening.
9. The cron tab is a table having a list of commands that are scheduled to be run at regular intervals.
Explanation: The cron-tab or cron table is a list of commands that are scheduled to be run at regular intervals. The crontab command opens the crontab for scheduling, editing, removing, modify scheduled tasks.
10. Which of the following command will remove the current crontab?
a) crontab -p
b) crontab -l
c) crontab -e
d) crontab -r
Explanation: We can see the contents of our crontab file using crontab -l command and can remove them with crontab -r. We can also enter cron commands using crontab -e command.
11. To find out how efficiently a program a used the system resources, which command is used?
Explanation: When there are multiple versions of a program and we want to find out how efficiently they’ve used the system resources we can use the time command. The time command accepts the entire command line to be timed as its argument. It executes the command and also displays the time usage on the terminal. For example,
$ time sort -o emp.txt invoi.txt real 0m19.811s // time elapsed from the invocation of command until its termination user 0m1.851s // time spent in executing itself sys 0m9.761s // time spent by the kernel in doing work on behalf of the user process
Sanfoundry Global Education & Learning Series – Unix.
To practice all areas of Unix Problems, here is complete set of 1000+ Multiple Choice Questions and Answers.