When you start a process (run a command), there are two ways you can run it: Foreground Processes Background Processes Foreground Processes: By default, every process that you start runs in the foreground. It gets its input from the keyboard and sends its output to the screen. Background Processes: A background process runs without being connected to your keyboard. If the background process requires any keyboard input, it waits. The advantage of running a process in the background is that you can run other commands; you do not have to wait until it completes to start another! The simplest way to start a background process is to add an ampersand ( &) at the end of the command. Stopping Processes: If a process is running in background mode then first you would need to get its Job ID using ps command and after that you can use kill command to kill the process as follows: $ps -f UID PID PPID C STIME TTY TIME CMD amrood6738 3662 0 10:23:03 pts/6 0:00 first_one amrood6739 3662 0 10:22:54 pts/6 0:00 second_one amrood3662 3657 0 08:10:53 pts/6 0:00 -ksh amrood6892 3662 4 10:51:50 pts/6 0:00 ps -f $kill 6738 Terminated Here kill command would terminate first_one process. If a process ignores a regular kill command, you can use kill -9 followed by the process ID as follows: $kill -9 6738 Terminated Question Execute and document the commands to: Run a process in background Run a process in foreground Call the process from background to foreground

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

When you start a process (run a command), there are two ways you can run it:

  • Foreground Processes

  • Background Processes

Foreground Processes:

By default, every process that you start runs in the foreground. It gets its input from the keyboard and sends its output to the screen.

Background Processes:

A background process runs without being connected to your keyboard. If the background process requires any keyboard input, it waits.

The advantage of running a process in the background is that you can run other commands; you do not have to wait until it completes to start another!

The simplest way to start a background process is to add an ampersand ( &) at the end of the command.

Stopping Processes:

If a process is running in background mode then first you would need to get its Job ID using ps command and after that you can use kill command to kill the process as follows:

$ps -f

UID PID PPID C STIME TTY TIME CMD amrood
6738 3662 0 10:23:03 pts/6 0:00 first_one amrood
6739 3662 0 10:22:54 pts/6 0:00 second_one amrood
3662 3657 0 08:10:53 pts/6 0:00 -ksh amrood
6892 3662 4 10:51:50 pts/6 0:00 ps -f

$kill 6738

Terminated

Here kill command would terminate first_one process. If a process ignores a regular kill command, you can use kill -9 followed by the process ID as follows:

$kill -9 6738

Terminated

Question

Execute and document the commands to:

  1. Run a process in background

  2. Run a process in foreground

  3. Call the process from background to foreground

Expert Solution
steps

Step by step

Solved in 2 steps with 10 images

Blurred answer
Knowledge Booster
Avoiding deadlock
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education