- A Unix process is an instance of an executing program It has a separate existence from all the other processes on the system we say that each process has its own address space
- A unique number known as its process-id or pid
- The pid of its parent process is the process which started it, usually a shell
Process state
- Processes also have state
- One a single-CPU machine, only one process is running
- Most processes are sleeping, waiting for input or output to finish
- There are a few other odd states: swapped, zombie, or stopped.
Job control
- The mechanism that shuffle processes from foreground, background and stopped is known as job control
Job control requires three condition for support
- A shell that support job control.
- The terminal driver in the kernel must support job control
- Support for certain job-control signals must be provided.
Foreground and Background Tasks
- Unix allows running processes to be disconnected from their terminals
- Unix has the concept of foreground processes which are attached to a user's terminal
- background processes, which have no terminal to read from
Job control & process management command
- ps - report process status
- kill - terminate or signal processes
Control process execution
- jobs - report job status
- bg - bring job to background process
- fg - bring job to foreground process
- stop - stop the job
Signals
- Signals are a technique used to notify a process that some condition has occurred.
- Ordinary users can only send signals to their own processes.
- The command to send signal to process is “kill”.
example:
$ kill -signal processid