Is it the process that has a controlling terminal, or is it the session that has a controlling terminal?
Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
When we say that a process has a controlling terminal, do we mean that the process itself has a controlling terminal, or is it the session that the process belongs to that has a controlling terminal?
I used to think that it is the session that has a controlling terminal, but then I have read the following (from here) which implies that it is the process that has a controlling terminal:
One of the attributes of a process is its controlling terminal. Child
processes created with fork inherit the controlling terminal from
their parent process. In this way, all the processes in a session
inherit the controlling terminal from the session leader. A session
leader that has control of a terminal is called the controlling
process of that terminal.
linux terminal
add a comment |Â
up vote
5
down vote
favorite
When we say that a process has a controlling terminal, do we mean that the process itself has a controlling terminal, or is it the session that the process belongs to that has a controlling terminal?
I used to think that it is the session that has a controlling terminal, but then I have read the following (from here) which implies that it is the process that has a controlling terminal:
One of the attributes of a process is its controlling terminal. Child
processes created with fork inherit the controlling terminal from
their parent process. In this way, all the processes in a session
inherit the controlling terminal from the session leader. A session
leader that has control of a terminal is called the controlling
process of that terminal.
linux terminal
1
Read The tty demystified page.
â Basile Starynkevitch
Nov 20 '17 at 12:12
Bam.... see if this helps clarify any too.... poincare.matf.bg.ac.rs/~ivana/courses/ps/sistemi_knjige/pomocno/â¦
â Facebook
Nov 20 '17 at 12:22
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
When we say that a process has a controlling terminal, do we mean that the process itself has a controlling terminal, or is it the session that the process belongs to that has a controlling terminal?
I used to think that it is the session that has a controlling terminal, but then I have read the following (from here) which implies that it is the process that has a controlling terminal:
One of the attributes of a process is its controlling terminal. Child
processes created with fork inherit the controlling terminal from
their parent process. In this way, all the processes in a session
inherit the controlling terminal from the session leader. A session
leader that has control of a terminal is called the controlling
process of that terminal.
linux terminal
When we say that a process has a controlling terminal, do we mean that the process itself has a controlling terminal, or is it the session that the process belongs to that has a controlling terminal?
I used to think that it is the session that has a controlling terminal, but then I have read the following (from here) which implies that it is the process that has a controlling terminal:
One of the attributes of a process is its controlling terminal. Child
processes created with fork inherit the controlling terminal from
their parent process. In this way, all the processes in a session
inherit the controlling terminal from the session leader. A session
leader that has control of a terminal is called the controlling
process of that terminal.
linux terminal
asked Nov 20 '17 at 12:10
Joseph
1075
1075
1
Read The tty demystified page.
â Basile Starynkevitch
Nov 20 '17 at 12:12
Bam.... see if this helps clarify any too.... poincare.matf.bg.ac.rs/~ivana/courses/ps/sistemi_knjige/pomocno/â¦
â Facebook
Nov 20 '17 at 12:22
add a comment |Â
1
Read The tty demystified page.
â Basile Starynkevitch
Nov 20 '17 at 12:12
Bam.... see if this helps clarify any too.... poincare.matf.bg.ac.rs/~ivana/courses/ps/sistemi_knjige/pomocno/â¦
â Facebook
Nov 20 '17 at 12:22
1
1
Read The tty demystified page.
â Basile Starynkevitch
Nov 20 '17 at 12:12
Read The tty demystified page.
â Basile Starynkevitch
Nov 20 '17 at 12:12
Bam.... see if this helps clarify any too.... poincare.matf.bg.ac.rs/~ivana/courses/ps/sistemi_knjige/pomocno/â¦
â Facebook
Nov 20 '17 at 12:22
Bam.... see if this helps clarify any too.... poincare.matf.bg.ac.rs/~ivana/courses/ps/sistemi_knjige/pomocno/â¦
â Facebook
Nov 20 '17 at 12:22
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
6
down vote
accepted
It is indeed the session.
The Single UNIX Specification describes the relationship in terms of the controlling terminal being "associated with a session". As it goes on to specify, a controlling terminal has a 1:1 relationship with a session. There is "at most one controlling terminal" associated with a session, and "a controlling terminal is associated with exactly one session".
The FreeBSD Design and Implementation book approaches this slightly differently, but reaches the same place. It is not possible for processes that share the same session to have different controlling terminals, nor is it possible for a single terminal to be the controlling terminal of multiple sessions.
Internally in FreeBSD that is how the data structures actually work. The process structure has a pointer to the pgrp
structure representing the process group that the process belongs to, which in turn points to the session
structure representing the session that the process group belongs to, which in turn points to the tty
structure of the controlling terminal for the session.
Internally in Linux, things are slightly more complex. Each task_struct
has a set of pointers to pid
structures for its process group ID and session ID; and has another pointer to a per-process signal_struct
structure that in turn directly points to the tty
structure of the controlling terminal.
Further reading
- George V. Neville-Neil, Marshall Kirk McKusick, and Robert N.M. Watson (2014-09-25). "Process Management". The Design and Implementation of the FreeBSD Operating System. Addison-Wesley Professional. ISBN 9780133761832.
- Donald Lewine (1991). "Terminal I/O". POSIX Programmers Guide. O'Reilly Media, Inc. ISBN 9780937175736.
- Daniel P. Bovet and Marco Cesati (2005). "Processes". Understanding the Linux Kernel: From I/O Ports to Process Management. 3rd edition. O'Reilly Media, Inc. ISBN 9780596554910.
- "Definitions". The Open Group Base Specifications. Issue 7. 2016. IEEE 1003.1:2008.
- "General Terminal Interface". The Open Group Base Specifications. Issue 7. 2016. IEEE 1003.1:2008.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
It is indeed the session.
The Single UNIX Specification describes the relationship in terms of the controlling terminal being "associated with a session". As it goes on to specify, a controlling terminal has a 1:1 relationship with a session. There is "at most one controlling terminal" associated with a session, and "a controlling terminal is associated with exactly one session".
The FreeBSD Design and Implementation book approaches this slightly differently, but reaches the same place. It is not possible for processes that share the same session to have different controlling terminals, nor is it possible for a single terminal to be the controlling terminal of multiple sessions.
Internally in FreeBSD that is how the data structures actually work. The process structure has a pointer to the pgrp
structure representing the process group that the process belongs to, which in turn points to the session
structure representing the session that the process group belongs to, which in turn points to the tty
structure of the controlling terminal for the session.
Internally in Linux, things are slightly more complex. Each task_struct
has a set of pointers to pid
structures for its process group ID and session ID; and has another pointer to a per-process signal_struct
structure that in turn directly points to the tty
structure of the controlling terminal.
Further reading
- George V. Neville-Neil, Marshall Kirk McKusick, and Robert N.M. Watson (2014-09-25). "Process Management". The Design and Implementation of the FreeBSD Operating System. Addison-Wesley Professional. ISBN 9780133761832.
- Donald Lewine (1991). "Terminal I/O". POSIX Programmers Guide. O'Reilly Media, Inc. ISBN 9780937175736.
- Daniel P. Bovet and Marco Cesati (2005). "Processes". Understanding the Linux Kernel: From I/O Ports to Process Management. 3rd edition. O'Reilly Media, Inc. ISBN 9780596554910.
- "Definitions". The Open Group Base Specifications. Issue 7. 2016. IEEE 1003.1:2008.
- "General Terminal Interface". The Open Group Base Specifications. Issue 7. 2016. IEEE 1003.1:2008.
add a comment |Â
up vote
6
down vote
accepted
It is indeed the session.
The Single UNIX Specification describes the relationship in terms of the controlling terminal being "associated with a session". As it goes on to specify, a controlling terminal has a 1:1 relationship with a session. There is "at most one controlling terminal" associated with a session, and "a controlling terminal is associated with exactly one session".
The FreeBSD Design and Implementation book approaches this slightly differently, but reaches the same place. It is not possible for processes that share the same session to have different controlling terminals, nor is it possible for a single terminal to be the controlling terminal of multiple sessions.
Internally in FreeBSD that is how the data structures actually work. The process structure has a pointer to the pgrp
structure representing the process group that the process belongs to, which in turn points to the session
structure representing the session that the process group belongs to, which in turn points to the tty
structure of the controlling terminal for the session.
Internally in Linux, things are slightly more complex. Each task_struct
has a set of pointers to pid
structures for its process group ID and session ID; and has another pointer to a per-process signal_struct
structure that in turn directly points to the tty
structure of the controlling terminal.
Further reading
- George V. Neville-Neil, Marshall Kirk McKusick, and Robert N.M. Watson (2014-09-25). "Process Management". The Design and Implementation of the FreeBSD Operating System. Addison-Wesley Professional. ISBN 9780133761832.
- Donald Lewine (1991). "Terminal I/O". POSIX Programmers Guide. O'Reilly Media, Inc. ISBN 9780937175736.
- Daniel P. Bovet and Marco Cesati (2005). "Processes". Understanding the Linux Kernel: From I/O Ports to Process Management. 3rd edition. O'Reilly Media, Inc. ISBN 9780596554910.
- "Definitions". The Open Group Base Specifications. Issue 7. 2016. IEEE 1003.1:2008.
- "General Terminal Interface". The Open Group Base Specifications. Issue 7. 2016. IEEE 1003.1:2008.
add a comment |Â
up vote
6
down vote
accepted
up vote
6
down vote
accepted
It is indeed the session.
The Single UNIX Specification describes the relationship in terms of the controlling terminal being "associated with a session". As it goes on to specify, a controlling terminal has a 1:1 relationship with a session. There is "at most one controlling terminal" associated with a session, and "a controlling terminal is associated with exactly one session".
The FreeBSD Design and Implementation book approaches this slightly differently, but reaches the same place. It is not possible for processes that share the same session to have different controlling terminals, nor is it possible for a single terminal to be the controlling terminal of multiple sessions.
Internally in FreeBSD that is how the data structures actually work. The process structure has a pointer to the pgrp
structure representing the process group that the process belongs to, which in turn points to the session
structure representing the session that the process group belongs to, which in turn points to the tty
structure of the controlling terminal for the session.
Internally in Linux, things are slightly more complex. Each task_struct
has a set of pointers to pid
structures for its process group ID and session ID; and has another pointer to a per-process signal_struct
structure that in turn directly points to the tty
structure of the controlling terminal.
Further reading
- George V. Neville-Neil, Marshall Kirk McKusick, and Robert N.M. Watson (2014-09-25). "Process Management". The Design and Implementation of the FreeBSD Operating System. Addison-Wesley Professional. ISBN 9780133761832.
- Donald Lewine (1991). "Terminal I/O". POSIX Programmers Guide. O'Reilly Media, Inc. ISBN 9780937175736.
- Daniel P. Bovet and Marco Cesati (2005). "Processes". Understanding the Linux Kernel: From I/O Ports to Process Management. 3rd edition. O'Reilly Media, Inc. ISBN 9780596554910.
- "Definitions". The Open Group Base Specifications. Issue 7. 2016. IEEE 1003.1:2008.
- "General Terminal Interface". The Open Group Base Specifications. Issue 7. 2016. IEEE 1003.1:2008.
It is indeed the session.
The Single UNIX Specification describes the relationship in terms of the controlling terminal being "associated with a session". As it goes on to specify, a controlling terminal has a 1:1 relationship with a session. There is "at most one controlling terminal" associated with a session, and "a controlling terminal is associated with exactly one session".
The FreeBSD Design and Implementation book approaches this slightly differently, but reaches the same place. It is not possible for processes that share the same session to have different controlling terminals, nor is it possible for a single terminal to be the controlling terminal of multiple sessions.
Internally in FreeBSD that is how the data structures actually work. The process structure has a pointer to the pgrp
structure representing the process group that the process belongs to, which in turn points to the session
structure representing the session that the process group belongs to, which in turn points to the tty
structure of the controlling terminal for the session.
Internally in Linux, things are slightly more complex. Each task_struct
has a set of pointers to pid
structures for its process group ID and session ID; and has another pointer to a per-process signal_struct
structure that in turn directly points to the tty
structure of the controlling terminal.
Further reading
- George V. Neville-Neil, Marshall Kirk McKusick, and Robert N.M. Watson (2014-09-25). "Process Management". The Design and Implementation of the FreeBSD Operating System. Addison-Wesley Professional. ISBN 9780133761832.
- Donald Lewine (1991). "Terminal I/O". POSIX Programmers Guide. O'Reilly Media, Inc. ISBN 9780937175736.
- Daniel P. Bovet and Marco Cesati (2005). "Processes". Understanding the Linux Kernel: From I/O Ports to Process Management. 3rd edition. O'Reilly Media, Inc. ISBN 9780596554910.
- "Definitions". The Open Group Base Specifications. Issue 7. 2016. IEEE 1003.1:2008.
- "General Terminal Interface". The Open Group Base Specifications. Issue 7. 2016. IEEE 1003.1:2008.
answered Nov 20 '17 at 14:01
JdeBP
29k459135
29k459135
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f405755%2fis-it-the-process-that-has-a-controlling-terminal-or-is-it-the-session-that-has%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Read The tty demystified page.
â Basile Starynkevitch
Nov 20 '17 at 12:12
Bam.... see if this helps clarify any too.... poincare.matf.bg.ac.rs/~ivana/courses/ps/sistemi_knjige/pomocno/â¦
â Facebook
Nov 20 '17 at 12:22