Call Girls In Goa 9316020077 Goa Call Girl By Indian Call Girls Goa
process group.
1. A process group is collection of one or more process,
usually associated with same job.
Each process group has a unique process group ID.
Process group ID’s are similar to process ID’s :
they are positive integers
And can be stored in pid_t data type.
2. the function getpgrp returns the process group ID of the calling
Process.
#include< unistd. h>
Pid_t getpgrp(void)
Returns:process group ID of calling
process.
In older BSD-derived systems the getpgrp() uses argument as
shown.
#include< unistd. h>
Pid_t getpgid(pid_t pid)
Returns:process group ID if OK.
-1 on error
3. If pid=0, the process group ID of calling process is
returned, thus
getpgid(0);
Is equivalent to
getpgrp();
• Each process group can have a process group leader.
• The leader is identified by its process group ID being
equal to its process ID.
• Process group lifetime: The period of time that begins
when the group is created and ends when the last
remaining process leaves the group.
4. • A process joins an existing group or creates a new process
group by calling setpgid().
#include< unistd. h>
Int setpgid(pid_t pid , pid_t pgid);
Return: 0 if ok,-1 on error
This function sets the process ID to pgid in the process whose
Process ID equals pid.
• if the 2 arguments are equal, the process specified by pid
becomes a process group leader.
•If pid=0,the process ID of the caller is used.
•If pgid=0,the process ID specified by pid is used as the process
Group ID.
5. sessions
A session is a collection of one or more process groups.
process group
proc1 proc2 Proc 3 Proc 4
Proc 5
Login shell
Process group
Process group
session
6. In the above figure we have 3 process groups in a single
session.
The processes in a process group are usually placed
there by a shell pipe line.
For example: for the above fig
proc 1| proc 2 &
proc3|proc4|proc5
a process establishes a new session by calling the setsid
function.
#include< unistd. h>
Pid_t setsid(void)
Returns: process group ID if OK,
, -1 on error
7. If the calling process is not a process group leader, this
function creates a new session, and 3 things can
happen:
1: the process becomes the session leader of this new
session. That is the only process in this new session.
2: the process becomes the process group leader of a
new process group. The new process group ID is the
new process ID of the calling process.
The process has no controlling terminal. If the process
had a controlling terminal before calling setsid, that
association is broken.
8. #include< unistd. h>
Pid_t getsid(pid_t pid);
Returns: session leader's process group
ID if OK, -1 on error
If pid=0, getsid returns the process group ID of the calling
process's session leader.
9. Sessions and process groups have a few other
characteristics.
A session can have a single controlling terminal. This is
usually the terminal device(in the case of terminal
login) or pseudo terminal device(in the case of a
network login) on which we login.
The session leader that establishes the connection to
the controlling terminal is called controlling process.
The process groups within a session can be divided
into a single foreground process group and one or
more background process groups.
Controlling terminal
10. Whenever we type the terminal’s interrupt key(often
DELETE or CONTROL-C), this causes the interrupt
signal be sent to all processes in the foreground
process group.
Whenever we type terminal’s quit key(often
CONTROL-BLCKSLASH), this causes the quit signal
to be sent to all processes in foreground process group.
If the modem(or network) disconnect is detected, the
hang-up signal is sent to the controlling process(I,e
session leader).
11. Background
process group
Login shell Proc 1 proc2 proc3 proc4
proc5Background process
Group session leader=
Controlling process
Foreground process group
Controlling
terminal
Terminal input and terminal
generated signals.
Modem disconnect
(hang-up-signal)