-
-
(a) Shadow file is readable only by root since others might try to find a matching password to the stored encrypted password (since it uses a lossy encryption).
The passwd file is readable by all since it contains more general information that is needed more often than the password such as user id details.
-
(b) Through the use of the SUID flag which gives the user executing such a file the same effective rights as the owner of the executable.
-
(c) Something like inetd, or an application that expects an answer from multiple connected processes (such as in P2P) and does not know which is going to respond first.
-
-
(a) Since each device is accessed through the use of a file descriptor, the underlying kernel cannot distinguish at that level which device driver to use. The way it works is that when creating the vnode, the pointers to the standard functions to read, write, ioctl, etc will be bound to the appropriate device driver functions, and thus accessing the device in the right way becomes automatic.
-
(b) Since there are so many machines out there, some being big endian, some little endian and god knows what else, a standard is required. This standard of communication is to transmit everything in big endian format and then let the app on each side call the appropriate conversion functions for the underlying architecture.
-
(c) An iterative server is used whenever the client will require a service which is relatively short in terms of data and computation (such as a time server). A concurrent server is used whenever each service will take several messages and computation to process (such as a web server). Using an iterative server is faster overall but has high risk of timing out incoming messages if it is busy processing.
-
-
(a) Context switches cost a lot of computation (including switching protection modes) so should be kept to a minimum.
-
(b) The OS will typically keep a table containing the process no, the socket no and the connection tuple to be able to map one to the other. Incoming packets have NO information about sockets or processes, but by looking up this table, the right process and socket can be found.
-
(c) Signals might need to be masked to protect certain critical sections from being interrupted. Sigsuspend will be used whenever one can a critical section that needs to mask signals and following that will need to block waiting for a signal. To make sure that sigprocmask and pause will not result in sleeping forever, one uses sigsuspend. Typical application is when a computation can proceed when another process (or processes) send it a signal that it can continue (maybe a consumer producer scenario)
|