Page 315 - DCAP403_Operating System
P. 315
Operating System
Notes
Example: A photo editing program could use the unnamed stream for the main image
and a named stream for a small thumbnail version. This scheme is simpler than the traditional
way of putting them in the same file one after another.
Another use of streams is in word processing. These programs often make two versions of a
document, a temporary one for use during editing and a final one when the user is done. By
making the temporary one a named stream and the final one the unnamed stream, both versions
automatically share a file name, security information, timestamps, etc., with no extra work.
The maximum stream length is 264 bytes. To get some idea of how big a 264-byte stream is,
imagine that the stream were written out in binary, with each of the 0s and 1s in each byte
occupying 1 mm of space. The 267-mm listing would be 15 light-years long, reaching far beyond
the solar system, to Alpha Centuri and back. File pointers are used to keep track of where a
process is in each stream, and these are 64 bits wide to handle the maximum length stream, which
is about 18.4 exabytes.
The Win32 API function calls for file and directory manipulation are roughly similar to their
UNIX counterparts, except most have more parameters and the security model is different.
Opening a file returns a handle, which is then used for reading and writing the file. For graphical
applications, no file handles are predefi ned.
Standard input, standard output, and standard error have to be acquired explicitly if needed;
in console mode they are preopened, however. Win32 also has a number of additional calls not
present in UNIX.
14.5 Networking
Windows 2000 supports both peer-to-peer and client-server networking. It also has facilities for
network management. The networking components in Windows 2000 provide data transport,
inter-process communication, file sharing across a network, and the ability to send print jobs to
remote printers.
To describe networking in Windows 2000, we will refer to two of the internal networking
interfaces, called the Network Device Interface Specification (NDIS) and the Transport Driver
Interface (TDI). The NDIS interface was developed in 1989 by Microsoft and 3Com to separate
network adapters from the transport protocols, so that either could be changed without affecting
the other. NDIS resides at the interface between the data-link control and media-access-control
layers in the OSI model and enables many protocols to operate over many different network
adapters. In terms of the OSI model, the TDI is the interface between the transport layer (layer
4) and the session layer (layer 5). This interface enables any session-layer component to use any
available transport mechanism. (Similar reasoning led to the streams mechanism in UNIX.) The
TDI supports both connection-based and connectionless transport, and has functions to send any
type of data.
14.5.1 Protocols
Windows 2000 implements transport protocols as drivers. These drivers can be loaded and
unloaded from the system dynamically, although in practice the system typically has to be
rebooted after a change. Windows 2000 comes with several networking protocols.
The server message-block (SMB) protocol was first introduced in MS-DOS 3.1. The system uses
the protocol to send I/O requests over the network.
The SMB protocol has four message types. The Session control messages are commands that
start and end a redirector connection to a shared resource at the server. A redirector uses File
308 LOVELY PROFESSIONAL UNIVERSITY