Page 253 - DCAP403_Operating System
P. 253

Operating System




                    Notes          Communication Pipes

                                   Pipes are a communication mechanism specific to all UNIX systems. A pipe, symbolised by a

                                   vertical bar (“|” character), makes it possible to assign the standard output of one command to
                                   the standard input of another, like a pipe enabling communication between the standard input
                                   of one command with the standard output of another one.
                                   In the following example, the standard output of the command ls -al is sent to the program sort,
                                   which is responsible for sorting the results in alphabetical order:

                                   ls -al | sort
                                   This makes it possible to connect a certain number of commands through successive pipes. In

                                   the example below, the command displays all the files in the current directory, selects the lines
                                   containing the word “zip” (using the grep command), and counts the total number of lines:
                                   ls -l | grep zip | wc -l

                                   13.2 Kernel Modules

                                   The Linux kernel is a Unix-like operating system kernel. It is the namesake of the Linux family
                                   of operating systems. Released under the GNU General Public License (GPL) and developed by
                                   contributors worldwide, Linux is one of the most prominent examples of free software/open
                                   source.
                                   The Linux Kernel was initially conceived and assembled by Linus Torvalds in 1991. Early on,
                                   the Minix community contributed code and ideas to the Linux kernel. At the time, the GNU
                                   Project had created many of the components required for a free software operating system, but
                                   its own kernel, GNU Hurd, was incomplete and unavailable. The BSD operating system had not
                                   yet freed itself from legal encumbrances. This meant that despite the limited functionality of the
                                   early versions, Linux rapidly accumulated developers and users who adopted code from those
                                   projects for use with the new operating system. Today the Linux kernel has received contributions
                                   from thousands of programmers.
                                   Linux operates in two modes - the Kernel mode (kernel space) and the User mode (user space).
                                   The kernel works in the highest level (also called supervisor mode) where it has all the authority,
                                   while the applications work in the lowest level where direct access to hardware and memory are
                                   prohibited. Keeping in line with the traditional Unix philosophy, Linux transfers the execution
                                   from user space to the kernel space through system calls and the hardware interrupts. The
                                   Kernel code executing the system call works in the context of the process, which invokes the
                                   system call. As it operates on behalf of the calling process, it can access the data in the processes
                                   address space. The kernel code that handles interrupts, works to the processes and related to any
                                   particular process.

                                   13.2.1  Linux Kernel Modules

                                   The Linux kernel is a monolithic kernel i.e. it is one single large program where all the functional
                                   components of the kernel have access to all of its internal data structures and routines. The
                                   alternative to this is the micro kernel structure where the functional pieces of the kernel are
                                   broken out into units with strict communication mechanism between them. This makes adding

                                   new components into the kernel, via the configuration process, rather time consuming. The best
                                   and the robust alternative is the ability to dynamically load and unload the components of the
                                   operating system using Linux Kernel Modules.
                                   The Linux kernel modules are piece of codes, which can be dynamically linked to the kernel
                                   (according to the need), even after the system booting. They can be unlinked from the kernel
                                   and removed when they are no longer needed. Mostly the Linux kernel modules are used for



          246                              LOVELY PROFESSIONAL UNIVERSITY
   248   249   250   251   252   253   254   255   256   257   258