Page 39 - DCAP403_Operating System
P. 39

Operating System




                    Notes          In UNIX every process has an alarm clock stored in its system-data segment. When the alarm
                                   goes off, signal SIGALRM is sent to the calling process. A child inherits its parent’s alarm clock
                                   value, but the actual clock isn’t shared. The alarm clock remains set across an exec.

                                   System Calls for Signaling

                                   A signal is a limited form of inter-process communication used in UNIX, UNIX-like, and other
                                   POSIX-compliant operating systems. Essentially it is an asynchronous notification sent to a

                                   process in order to notify it of an event that occurred. The number of signals available is system
                                   dependent. When a signal is sent to a process, the operating system interrupts the process’ normal

                                   flow of execution. Execution can be interrupted during any non-atomic instruction. If the process
                                   has previously registered a signal handler, that routine is executed. Otherwise the default signal
                                   handler is executed.
                                   Programs can respond to signals three different ways. These are:
                                   1.   Ignore the signal: This means that the program will never be informed of the signal no
                                       matter how many times it occurs.
                                   2.   A signal can be set to its default state, which means that the process will be ended when it
                                       receives that signal.

                                   3.   Catch the signal: When the signal occurs, the system will transfer control to a previously
                                       defined subroutine where it can respond to the signal as is appropriate for the program.

                                   System Calls for File Management

                                   The  file structure related system calls available in some operating system like UNIX let you




                                   create, open, and close files, read and write files, randomly access files, alias and remove fi les, get

                                   information about files, check the accessibility of files, change protections, owner, and group of


                                   files, and control devices. These operations either use a character string that defines the absolute



                                   or relative path name of a file, or a small integer called a file descriptor that identifies the I/O

                                   channel. When doing I/O, a process specifi es the file descriptor for an I/O channel, a buffer

                                   to be filled or emptied, and the maximum size of data to be transferred. An I/O channel may

                                   allow input, output, or both. Furthermore, each channel has a read/write pointer. Each I/O

                                   operation starts where the last operation finished and advances the pointer by the number of
                                   bytes transferred. A process can access a channel’s data randomly by changing the read/write
                                   pointer.
                                   These types of system calls are used to manage fi les.
                                         Example: Create fi le, delete file, open, close, read, write etc.

                                   System Calls for Directory Management
                                   You may need the same sets of operations as for file management for directories also. If you



                                   have a directory structure for organizing files in the file system. In addition, for either fi les or
                                   directories, you need to be able to determine the values of various attributes, and perhaps to reset

                                   them if necessary. File attributes include the file name, a file type, protection codes, accounting

                                   information, and so on. At least two system calls, get  file attribute and set  file attribute, are


                                   required for this function. Some operating systems provide many more calls.
                                   System Calls for Protection
                                   Improper use of the system can easily cause a system crash. Therefore some level of control is
                                   required; the design of the microprocessor architecture on basically all modern systems (except
          32                               LOVELY PROFESSIONAL UNIVERSITY
   34   35   36   37   38   39   40   41   42   43   44