Process Relationships - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Process Relationships

Description:

login program takes user ID, prompts for password, and ... process group ID's are positive integers. process groups may ... process group of caller ... – PowerPoint PPT presentation

Number of Views:97
Avg rating:3.0/5.0
Slides: 17
Provided by: richarde78
Category:

less

Transcript and Presenter's Notes

Title: Process Relationships


1
Process Relationships
  • all processes have parent processes
  • parents are notified of child termination
  • can obtain exit status
  • all processes belong to process groups
  • all process groups belong to sessions
  • POSIX .1 introduced sessions concept

2
Terminal Logins
  • classic UNIX access provided by dumb terminals
  • monitor, keyboard and local line or modem
    connection
  • contemporary access uses the terminal metaphor
  • pseudo-terminals provided for network access

3
4.3 BSD Terminal Logins
  • terminal logins involve opening terminal or
    pseudo-terminal devices and execing the login
    program
  • login program takes user ID, prompts for
    password, and then establishes parameters of the
    working session
  • last step is for login to exec our login shell

4
SVR4 Terminal Logins
  • SVR4 logins are handled as per BSD, with the
    addition of ttymon logins.
  • ttymon logins have a different call structure,
    but function as per BSD logins from the exec of
    the login program forward

5
Network Logins
  • network logins use the same terminal metaphor
    that physical terminal logins employ
  • from the call to login forward, local terminal
    logins and network logins are essentially similar

6
BSD and SVR4 Network Logins
  • network logins take place via a TCP/IP connection
    request, at which point a specific server
    establishes a two-way communication and opens a
    pseudo-terminal
  • telnet telnetd handles terminal access
  • ssh sshd handles terminal access
  • both BSD and SVR4 use the same basic logic for
    terminal access, though the call structures vary

7
Common login Features
  • all logins evaluate user data from password,
    group, etc. and establish working environments
  • all logins complete by execing a shell process
    (login shell), and finish when that shell exits

8
Process Groups
  • all processes belong to a process group
  • processes default to the process group of their
    parent or execer
  • process group IDs are positive integers
  • process groups may have a leader
  • PGID PID for leader
  • processes can join other groups in same session
  • must not be group leader

9
PGID functions
  • two function used to manipulate process groups
  • getpgrp() fetches process group of caller
  • setpgid() places a process in an existing group
    or creates a new one
  • can be done for calling process or children

10
Sessions
  • collection of one or more process groups
  • processes are usually grouped via a pipeline
  • created by calling setsid()

11
setsid() function
  • setsid() does three things
  • caller made session leader of new session
  • caller made group leader of new group
  • process is made to have no controlling terminal,
    if one existed prior to the call
  • caller must not be a process group leader

12
Controlling Terminal
  • each session can have only one controlling
    terminal, and a terminal controls at most one
    session
  • the session leader connected to the controlling
    terminal is the controlling process
  • session leaders allocate controlling terminals
    for their sessions via ioctl calls
  • process groups in a session with a controlling
    terminal are either foreground or background
  • one foreground group
  • terminal signals go to this group
  • one or more background groups

13
tcgetpgrp() and tcsetpgrp() Functions
  • tcgetpgrp() returns foreground group associated
    with a particular file descriptor
  • tcsetpgrp() sets the foreground process group
  • can be used by process with a controlling
    terminal to change the foreground group to one
    from another group within the same session

14
Job Control
  • BSD feature from early 80s
  • controls multiple foreground and background
    processes
  • shells with job control can assign processes to
    foreground or background
  • foreground processes receive terminal input,
    background do not
  • standard terminal signals are sent to the
    foreground group

15
Job Controll Shell Execution of Programs
  • programs executed within job control shells are
    assigned to the foreground group by default
  • if assigned to the background group, programs
    will stop if need to read from terminal
  • output to terminal may be allowed or disallowed
  • user will be notified at next prompt
  • background process can be moved to foreground

16
Orphaned Process Groups
  • a process group is orphaned when no parent
    processes exist outside the group but in the
    session.
  • terminal signals are not sent to the processes in
    orphaned groups
  • any stopped process in an orphaned group is
    automatically sent the the SIGHUP and SIGCONT
    signals when the group is orphaned.
Write a Comment
User Comments (0)
About PowerShow.com