16.05.2015 Views

Working with the Unix OS

Working with the Unix OS

Working with the Unix OS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

I/O Subsystem<br />

Control Terminal<br />

Terminal on which <strong>the</strong> user logs into <strong>the</strong> system.<br />

When a user presses DELETE, BREAK, RUBOUT, QUIT keys <strong>the</strong> interrupt handler invokes <strong>the</strong> line discipline,<br />

which sends a signal to all processes in <strong>the</strong> control process group.<br />

Indirect Terminal Drivers<br />

/dev/tty<br />

- current terminal<br />

/dev/console - console device<br />

Login<br />

algorithm login /* procedure for logging in */<br />

{<br />

getty process executes:<br />

set process group (setpgrp system calO;<br />

open tty line; /* sleeps until opened */<br />

if (open successful)<br />

{<br />

exec login program:<br />

prompt for user name;<br />

turn off echo, prompt for password;<br />

if (successful) /* matches password in letclpasswd */<br />

{<br />

put tty in canonical mode (ioctl);<br />

exec shell;<br />

}<br />

else<br />

count login attempts, try again up to a point;<br />

}<br />

}<br />

Figure 41. Loggin in<br />

Streams<br />

- different drivers tend to duplicate functionality<br />

- a full-duplex connection between a process and a device driver<br />

- a set of linear linked queue pairs, one for input and one for output<br />

Each queue contains:<br />

- open procedure<br />

- close procedure<br />

- put - to pass message into queue<br />

- service - to execute queue<br />

- pointer to next queue in stream<br />

- pointer to list of messages awaiting service<br />

- pointer to private data structure - maintains state of queue<br />

- flags - high and low water marks - flow control<br />

Figure 42. A Stream after Open<br />

151

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!