SlideShare a Scribd company logo
1 of 42
Download to read offline
UNIX INTERNALS

Disk and Terminal Drivers

       A. Sarang
DEVICE DRIVERS :-

 The I/O Subsystem allows the process to
  communicate with the peripheral devices
  such as :-
 disks, terminal, tape drives, printers,
  networks and kernel modules.
 A disk can be partitioned into a no. of file
  systems.
 An administrator can leave a partition
  mounted or unmounted and can make it
  read only / read write.
Disk driver

 A disk driver translates the file system
  address to the particular sector of the disk.
 The file system address consists of a logical
  device number and a block no.
 Eg : /dev/dsk0 of a DEC RP07 disk
 Which means accessing section 0 of the DEC
  RP07 disk.
Accessing block 940 of dev/dsk3

 Section 3 starts at block
  336000
 336000+940
 336940
Accessing disk data

 Using raw or block interface
 Eg : lseek , ls
 Using commands like mkfs & fsck.
 They access the file systems directly.
 Lseek sets the file offset for the open file
 Mkfs : formats disk section for UNIX file
  system & creates the super block , inode , list
  , linked list of free disk blocks and root
  directory.
 Fsck : checks the consistency of the file
  system and corrects the errors.
Block and raw interface

 Ls –l /dev/dsk15 /dev/rdsk15
 Br ----- 2 root 0,21 Feb12 15:00 /dev/dsk15


 0 = Major n0.
 21= Minor no.
 2= physical drive
 1= section no.
 Block interface = read , write
 Raw interface = lseek
# include “fcntl.h”
Main()
{
Char buf1[4096],buf2[4096];
Int fd1,fd2,I;
If(((fd1=open(“/dev/dk5”,O_RDONLY))==-
    1)||((fd2=open(“/dev/rdsk5”,O_RDONLY))==-1))
{
Printf(“failure on openn”);
Exit();
}
Lseek(fd1,8192L,0);
Lseek(fd2,8192L,0);
If((read(fd1,buf1,sizeof(buf1))==-1)||
   (read(fd2,buf3,sizeof(buf1))==-1))
{
Printf(“failure on readn”);
Exit();
}
For(i=0;i<sizeof(buf1);i++)
   If(buf1[i]!=buf2[i])
   {
       Printf(“different at offset %dn”,i);
       Exit();
   }
Printf(“reads matchn”);
}
From the program we infer :-

 Using read & write to the disk directly is
  dangerous .
 Jeopardizes system security.
 Administrators need to put appropriate
  permissions for the disk device.
 For eg : /dev/dsk15 should be owned by root
  to read but should not allow other users to
  read or write.
 Read or write routine converts byte offset to
  block offset .
 Use of block interface needs an extra copy of
  data between user address space & kernel
  buffers
 Use of raw interface on the other hand is
  faster.
TERMINAL DRIVERS

 Terminal Drivers are used to control
  the transmission of data to & from
  the terminals.
 But terminals are also user interface
  to the sytem unlike disks.
Line Disciplines

 Set of manipulations that input editing does.
 For eg : for moving one step backward , you
  have BACKSPACE in some terminals and DEL
  in some others.
Modes of a terminal

 Raw mode
 Canonical mode
 Raw mode sends the entire sequence typed
  sequence including the erase characters.
 In Canonical mode , line disciple buffers the
  data into lines and processes erase characters
  before sending the revised sequence to the
  reading process.
 Canonical mode processes edit, delete.
Example

 Hello data DEL DEL DEL DEL world


 RAW mode output :-
 Hello data DEL DEL DEL DEL world


 Canonical mode output :-
 Hello world
Functions of line discipline:-

 Parse the input string into lines.
 Process the erase characters.
 Process “kill” character that invalidates all
  characters typed so far on the current line.
 To echo(write) received characters to the
  terminal.
 To expand o/p such as tab character to a
  sequence of blank spaces
 Generate signals to process terminal
  hangups, line breaks or response to user
  hitting the delete key.
 To allow raw mode that does not interpret
  special characters such as erase,kill or
  carriage return.
Data structures used

 Cblocks
 Clists
 Buffer is made of several physical entities or
  character blocks – Cblocks.
 Clist is a variable length linked list of Cblocks.
 Cblock has a pointer to the next Cblock on the
  linked list.
Data structures used :-

 Three Clists :-
 O/p Clist : Clist to store o/p of terminal
 Raw i/p Clist : Clist to store raw i/p data
  (provided by terminal interrupt handler as the
  user types in).
 Canonical i/p Clist : Clist to store “cooked” i/p
  data(after line discipline converts spl
  characters )
Terminal driver in Canonical mode :-


 Write :-
 Terminal driver invokes the line discipline.
 Line discipline loops reading o/p characters
  from user address space & places them on o/p
  clist.
 If no. of characters in o/p clist is greater than
  the “high-water mark” , it puts the writing
  process to sleep.
 If the amount of data is below the “low water
  mark” , the interrupt handler awakens all
  processes asleep.
 Line discipline processes the spl characters .
 Write operation is started with data on o/p
  clist.
Algorithm for write

Algorithm terminal_write
{
  while (more data to be copied from user
  space)
  {
     if (tty flooded with o/p data)
     {
             start write operation on hardware
  with data on o/p clist;
Sleep;
Continue;
}
  copy cblock size of data from user space to o/p
  clist ;
  line discipline converts tab characters etc;
}
  start write operation on h/w with data on output
  clist;
}
Read :-

 If no data is available in the i/p clist the
  reading process sleeps until the arrival of a
  line of data.
 Whenever data is entered , terminal interrupt
  handler places the data in raw clist for i/p &
  o/p clist for echoing back to the terminal.
 If terminal is in raw mode , copy all data from
  raw clist to canonical clist.
 If terminal is in canonical mode , copy one
  character at a time from raw clist to canonical
  clist , process the data.
 Finally copy cblocks from canonical clist to
  user address space.
Algorithm for read

Algorithm terminal_read
{
   while (no data on raw clist )
   {
       if (tty opened with no delay option)
       return;
       if (tty in raw mode based on timer & timer not
   active)
       arrange for timer wakeup(callout table);
Sleep (event : data arrives from terminal)
}
/*there is data on raw clist*/
If(tty in raw mode)
    copy all data from raw clist to canonical clist
Else /*tty in canonical mode*/
{
    while(characters on raw clist)
    {
          copy one character at a time from raw clist to canonical clist;
          do erase , kill processing ;
    if (char is carriage return or e-o-f )
Break;
}}}
While (characters on canonical clist and read
 count not satisfied)

Copy from cblocks on canonical list to user
  address space;

}
Terminal driver in Raw mode

 In raw mode , line disclipline transmits
  characters exactly as the user types them: no
  input processing is done.
 Kernel must know when to satisfy user read
  calls since carriage return is treated as
  ordinary character
Satisfying read system calls

 Read system calls are satisfied after minimum
  no. of characters are input at the terminal.
 After waiting a fixed time from the receipt of
  any characters from the terminal.
 The kernel times the entry of characters from
  the terminal by placing entries in the callout
  table.
 Algorithm is same as canonical case.
Terminal Polling

 Terminal polling can be done by opening a
  terminal with “no delay” option & polling all
  of the devices.
 However this leads to wasting processing
  power.
Terminal Polling in BSD

 BSD system has a select system call for
    device polling.
   Select (nfds,rfds,wfds,efds,timeout)
   Nfds = no.of file descriptors
   Rfds,wfds & efds – bit masks
   Timeout = how long select should sleep.
Control Terminal

 It is the terminal on which a user logs into the
  system .
 It controls processes that the user initiates
  from the terminal.
 Plays an important role in handling signals.
 When user presses delete , break or quit keys,
  it sends appropriate signals to all the
  processes.
Indirect Terminal Driver

 Unix systems provide indirect terminal
  access via the device file /dev/tty .
 Kernel can define a special device no. for the
  indirect terminal file with a special entry in
  the character device switch table.
 Allocating inode for the control terminal.
Logging in

 First the get ty (get terminal process
  executes) and the process is set.
 Open terminal line.
 If open successful , exec login program &
  prompt for username and password.
 If login successful , put the terminal in
  canonical mode else try again.

More Related Content

What's hot

Linux process management
Linux process managementLinux process management
Linux process management
Raghu nath
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
Pradeep Kumar TS
 
The linux networking architecture
The linux networking architectureThe linux networking architecture
The linux networking architecture
hugo lu
 

What's hot (20)

Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
Linux process management
Linux process managementLinux process management
Linux process management
 
PCD - Process control daemon
PCD - Process control daemonPCD - Process control daemon
PCD - Process control daemon
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
 
Linux System Programming - File I/O
Linux System Programming - File I/O Linux System Programming - File I/O
Linux System Programming - File I/O
 
Demand paging
Demand pagingDemand paging
Demand paging
 
Asynchronous data transfer
Asynchronous data transferAsynchronous data transfer
Asynchronous data transfer
 
BeagleBoard-xM Booting Process
BeagleBoard-xM Booting ProcessBeagleBoard-xM Booting Process
BeagleBoard-xM Booting Process
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
 
Linux booting Process
Linux booting ProcessLinux booting Process
Linux booting Process
 
File System Implementation - Part1
File System Implementation - Part1File System Implementation - Part1
File System Implementation - Part1
 
File Pointers
File PointersFile Pointers
File Pointers
 
The linux networking architecture
The linux networking architectureThe linux networking architecture
The linux networking architecture
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Storage Management in Linux OS.ppt
Storage Management in Linux OS.pptStorage Management in Linux OS.ppt
Storage Management in Linux OS.ppt
 
Memory management
Memory managementMemory management
Memory management
 
Assemblers: Ch03
Assemblers: Ch03Assemblers: Ch03
Assemblers: Ch03
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Cs8591 Computer Networks
Cs8591 Computer NetworksCs8591 Computer Networks
Cs8591 Computer Networks
 
Operating system critical section
Operating system   critical sectionOperating system   critical section
Operating system critical section
 

Viewers also liked

Ch 6 development plan and quality plan
Ch 6 development plan and quality planCh 6 development plan and quality plan
Ch 6 development plan and quality plan
Kittitouch Suteeca
 
Operating system concepts (notes)
Operating system concepts (notes)Operating system concepts (notes)
Operating system concepts (notes)
Sohaib Danish
 
Pert & cpm project management
Pert & cpm   project managementPert & cpm   project management
Pert & cpm project management
Rahul Dubey
 

Viewers also liked (20)

Os
OsOs
Os
 
Input output systems ppt - cs2411
Input output systems ppt - cs2411Input output systems ppt - cs2411
Input output systems ppt - cs2411
 
Unix Operating System
Unix Operating SystemUnix Operating System
Unix Operating System
 
Unix operating system
Unix operating systemUnix operating system
Unix operating system
 
Device drivers tsp
Device drivers tspDevice drivers tsp
Device drivers tsp
 
Linux io
Linux ioLinux io
Linux io
 
Os
OsOs
Os
 
Cse
CseCse
Cse
 
Chap2 hdd1
Chap2 hdd1Chap2 hdd1
Chap2 hdd1
 
Input output in linux
Input output in linuxInput output in linux
Input output in linux
 
Kernel I/O subsystem
Kernel I/O subsystemKernel I/O subsystem
Kernel I/O subsystem
 
Ch 6 development plan and quality plan
Ch 6 development plan and quality planCh 6 development plan and quality plan
Ch 6 development plan and quality plan
 
Chapter 13 - I/O Systems
Chapter 13 - I/O SystemsChapter 13 - I/O Systems
Chapter 13 - I/O Systems
 
CASE tools and their effects on software quality
CASE tools and their effects on software qualityCASE tools and their effects on software quality
CASE tools and their effects on software quality
 
Device Drivers
Device DriversDevice Drivers
Device Drivers
 
Operating system concepts (notes)
Operating system concepts (notes)Operating system concepts (notes)
Operating system concepts (notes)
 
Pert cpm
Pert cpmPert cpm
Pert cpm
 
Pert & cpm project management
Pert & cpm   project managementPert & cpm   project management
Pert & cpm project management
 
Personal swot analysis
Personal swot analysisPersonal swot analysis
Personal swot analysis
 
Personal Swot Analysis
Personal Swot AnalysisPersonal Swot Analysis
Personal Swot Analysis
 

Similar to Ui disk & terminal drivers

5.6 Basic computer structure microprocessors
5.6 Basic computer structure   microprocessors5.6 Basic computer structure   microprocessors
5.6 Basic computer structure microprocessors
lpapadop
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
Acácio Oliveira
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
sean chen
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eve
chiportal
 
Shellcoding in linux
Shellcoding in linuxShellcoding in linux
Shellcoding in linux
Ajin Abraham
 
Data file handling
Data file handlingData file handling
Data file handling
TAlha MAlik
 

Similar to Ui disk & terminal drivers (20)

Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
 
lec4.docx
lec4.docxlec4.docx
lec4.docx
 
5.6 Basic computer structure microprocessors
5.6 Basic computer structure   microprocessors5.6 Basic computer structure   microprocessors
5.6 Basic computer structure microprocessors
 
The New Systems Performance
The New Systems PerformanceThe New Systems Performance
The New Systems Performance
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
 
Performance Tuning Using oratop
Performance Tuning Using oratop Performance Tuning Using oratop
Performance Tuning Using oratop
 
Andresen 8 21 02
Andresen 8 21 02Andresen 8 21 02
Andresen 8 21 02
 
Netkitmig
NetkitmigNetkitmig
Netkitmig
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eve
 
Erlang OTP
Erlang OTPErlang OTP
Erlang OTP
 
Shellcoding in linux
Shellcoding in linuxShellcoding in linux
Shellcoding in linux
 
Writing Character driver (loadable module) in linux
Writing Character driver (loadable module) in linuxWriting Character driver (loadable module) in linux
Writing Character driver (loadable module) in linux
 
Assembly language progarmming
Assembly language progarmmingAssembly language progarmming
Assembly language progarmming
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
Ccna Imp Guide
Ccna Imp GuideCcna Imp Guide
Ccna Imp Guide
 
x86_1.ppt
x86_1.pptx86_1.ppt
x86_1.ppt
 
Terminals and Shells
Terminals and ShellsTerminals and Shells
Terminals and Shells
 
Data file handling
Data file handlingData file handling
Data file handling
 

More from Sarang Ananda Rao

More from Sarang Ananda Rao (10)

Reducing Inefficiencies in Financial Markets
Reducing Inefficiencies in Financial MarketsReducing Inefficiencies in Financial Markets
Reducing Inefficiencies in Financial Markets
 
Partners Healthcare Case Analysis
Partners Healthcare Case AnalysisPartners Healthcare Case Analysis
Partners Healthcare Case Analysis
 
Auction analysis from Kaggle
Auction analysis from KaggleAuction analysis from Kaggle
Auction analysis from Kaggle
 
Personal Finance: Portfolio Optimization using Jensen's Performance Measure
Personal Finance: Portfolio Optimization using Jensen's Performance MeasurePersonal Finance: Portfolio Optimization using Jensen's Performance Measure
Personal Finance: Portfolio Optimization using Jensen's Performance Measure
 
ACG Case Competition 2016 - Sierra Securities
ACG Case Competition 2016 - Sierra SecuritiesACG Case Competition 2016 - Sierra Securities
ACG Case Competition 2016 - Sierra Securities
 
Ticketing platform for cinemalls
Ticketing platform for cinemallsTicketing platform for cinemalls
Ticketing platform for cinemalls
 
Redundancy schemes for deduplicated cloud storage systems
Redundancy schemes for deduplicated cloud storage systemsRedundancy schemes for deduplicated cloud storage systems
Redundancy schemes for deduplicated cloud storage systems
 
Musicperk - Developro 2012
Musicperk - Developro 2012Musicperk - Developro 2012
Musicperk - Developro 2012
 
CMS & Chrome Extension Development
CMS & Chrome Extension DevelopmentCMS & Chrome Extension Development
CMS & Chrome Extension Development
 
Introduction to SSH & PGP
Introduction to SSH & PGPIntroduction to SSH & PGP
Introduction to SSH & PGP
 

Ui disk & terminal drivers

  • 1. UNIX INTERNALS Disk and Terminal Drivers A. Sarang
  • 2. DEVICE DRIVERS :-  The I/O Subsystem allows the process to communicate with the peripheral devices such as :-  disks, terminal, tape drives, printers, networks and kernel modules.
  • 3.
  • 4.  A disk can be partitioned into a no. of file systems.  An administrator can leave a partition mounted or unmounted and can make it read only / read write.
  • 5. Disk driver  A disk driver translates the file system address to the particular sector of the disk.  The file system address consists of a logical device number and a block no.  Eg : /dev/dsk0 of a DEC RP07 disk  Which means accessing section 0 of the DEC RP07 disk.
  • 6.
  • 7. Accessing block 940 of dev/dsk3  Section 3 starts at block 336000  336000+940  336940
  • 8. Accessing disk data  Using raw or block interface  Eg : lseek , ls  Using commands like mkfs & fsck.  They access the file systems directly.  Lseek sets the file offset for the open file
  • 9.  Mkfs : formats disk section for UNIX file system & creates the super block , inode , list , linked list of free disk blocks and root directory.  Fsck : checks the consistency of the file system and corrects the errors.
  • 10. Block and raw interface  Ls –l /dev/dsk15 /dev/rdsk15  Br ----- 2 root 0,21 Feb12 15:00 /dev/dsk15  0 = Major n0.  21= Minor no.  2= physical drive  1= section no.
  • 11.  Block interface = read , write  Raw interface = lseek
  • 12. # include “fcntl.h” Main() { Char buf1[4096],buf2[4096]; Int fd1,fd2,I; If(((fd1=open(“/dev/dk5”,O_RDONLY))==- 1)||((fd2=open(“/dev/rdsk5”,O_RDONLY))==-1)) { Printf(“failure on openn”); Exit(); } Lseek(fd1,8192L,0); Lseek(fd2,8192L,0);
  • 13. If((read(fd1,buf1,sizeof(buf1))==-1)|| (read(fd2,buf3,sizeof(buf1))==-1)) { Printf(“failure on readn”); Exit(); } For(i=0;i<sizeof(buf1);i++) If(buf1[i]!=buf2[i]) { Printf(“different at offset %dn”,i); Exit(); } Printf(“reads matchn”); }
  • 14. From the program we infer :-  Using read & write to the disk directly is dangerous .  Jeopardizes system security.  Administrators need to put appropriate permissions for the disk device.  For eg : /dev/dsk15 should be owned by root to read but should not allow other users to read or write.
  • 15.  Read or write routine converts byte offset to block offset .  Use of block interface needs an extra copy of data between user address space & kernel buffers  Use of raw interface on the other hand is faster.
  • 16. TERMINAL DRIVERS  Terminal Drivers are used to control the transmission of data to & from the terminals.  But terminals are also user interface to the sytem unlike disks.
  • 17. Line Disciplines  Set of manipulations that input editing does.  For eg : for moving one step backward , you have BACKSPACE in some terminals and DEL in some others.
  • 18. Modes of a terminal  Raw mode  Canonical mode  Raw mode sends the entire sequence typed sequence including the erase characters.  In Canonical mode , line disciple buffers the data into lines and processes erase characters before sending the revised sequence to the reading process.  Canonical mode processes edit, delete.
  • 19. Example  Hello data DEL DEL DEL DEL world  RAW mode output :-  Hello data DEL DEL DEL DEL world  Canonical mode output :-  Hello world
  • 20. Functions of line discipline:-  Parse the input string into lines.  Process the erase characters.  Process “kill” character that invalidates all characters typed so far on the current line.  To echo(write) received characters to the terminal.  To expand o/p such as tab character to a sequence of blank spaces
  • 21.  Generate signals to process terminal hangups, line breaks or response to user hitting the delete key.  To allow raw mode that does not interpret special characters such as erase,kill or carriage return.
  • 22.
  • 23. Data structures used  Cblocks  Clists  Buffer is made of several physical entities or character blocks – Cblocks.  Clist is a variable length linked list of Cblocks.  Cblock has a pointer to the next Cblock on the linked list.
  • 24.
  • 25. Data structures used :-  Three Clists :-  O/p Clist : Clist to store o/p of terminal  Raw i/p Clist : Clist to store raw i/p data (provided by terminal interrupt handler as the user types in).  Canonical i/p Clist : Clist to store “cooked” i/p data(after line discipline converts spl characters )
  • 26.
  • 27. Terminal driver in Canonical mode :-  Write :-  Terminal driver invokes the line discipline.  Line discipline loops reading o/p characters from user address space & places them on o/p clist.  If no. of characters in o/p clist is greater than the “high-water mark” , it puts the writing process to sleep.
  • 28.  If the amount of data is below the “low water mark” , the interrupt handler awakens all processes asleep.  Line discipline processes the spl characters .  Write operation is started with data on o/p clist.
  • 29. Algorithm for write Algorithm terminal_write { while (more data to be copied from user space) { if (tty flooded with o/p data) { start write operation on hardware with data on o/p clist;
  • 30. Sleep; Continue; } copy cblock size of data from user space to o/p clist ; line discipline converts tab characters etc; } start write operation on h/w with data on output clist; }
  • 31. Read :-  If no data is available in the i/p clist the reading process sleeps until the arrival of a line of data.  Whenever data is entered , terminal interrupt handler places the data in raw clist for i/p & o/p clist for echoing back to the terminal.
  • 32.  If terminal is in raw mode , copy all data from raw clist to canonical clist.  If terminal is in canonical mode , copy one character at a time from raw clist to canonical clist , process the data.  Finally copy cblocks from canonical clist to user address space.
  • 33. Algorithm for read Algorithm terminal_read { while (no data on raw clist ) { if (tty opened with no delay option) return; if (tty in raw mode based on timer & timer not active) arrange for timer wakeup(callout table); Sleep (event : data arrives from terminal) }
  • 34. /*there is data on raw clist*/ If(tty in raw mode) copy all data from raw clist to canonical clist Else /*tty in canonical mode*/ { while(characters on raw clist) { copy one character at a time from raw clist to canonical clist; do erase , kill processing ; if (char is carriage return or e-o-f ) Break; }}}
  • 35. While (characters on canonical clist and read count not satisfied) Copy from cblocks on canonical list to user address space; }
  • 36. Terminal driver in Raw mode  In raw mode , line disclipline transmits characters exactly as the user types them: no input processing is done.  Kernel must know when to satisfy user read calls since carriage return is treated as ordinary character
  • 37. Satisfying read system calls  Read system calls are satisfied after minimum no. of characters are input at the terminal.  After waiting a fixed time from the receipt of any characters from the terminal.  The kernel times the entry of characters from the terminal by placing entries in the callout table.  Algorithm is same as canonical case.
  • 38. Terminal Polling  Terminal polling can be done by opening a terminal with “no delay” option & polling all of the devices.  However this leads to wasting processing power.
  • 39. Terminal Polling in BSD  BSD system has a select system call for device polling.  Select (nfds,rfds,wfds,efds,timeout)  Nfds = no.of file descriptors  Rfds,wfds & efds – bit masks  Timeout = how long select should sleep.
  • 40. Control Terminal  It is the terminal on which a user logs into the system .  It controls processes that the user initiates from the terminal.  Plays an important role in handling signals.  When user presses delete , break or quit keys, it sends appropriate signals to all the processes.
  • 41. Indirect Terminal Driver  Unix systems provide indirect terminal access via the device file /dev/tty .  Kernel can define a special device no. for the indirect terminal file with a special entry in the character device switch table.  Allocating inode for the control terminal.
  • 42. Logging in  First the get ty (get terminal process executes) and the process is set.  Open terminal line.  If open successful , exec login program & prompt for username and password.  If login successful , put the terminal in canonical mode else try again.