OPERATING SYSTEM : Part I


1.12 Computing Environment:
1.12.1 Traditional Computing:
·              Web technologies are stretching boundaries of traditional computing.
·         N/w computers are essentially terminals that understand web-based computing
·         Firewalls are to protect their n/w from security breaches.
1.12.2.Client- server Computing:
·                              System acts as a server system to satisfy request generated by client systems.
Computer server system:
·                              It provides an interface to which a client can send a request to perform an action.
·                              The server executes the action and send back to the client.
File server system:
·         It provides a file system interface where clients can create, update, read and delete files.
1.12.3 Peer-to-Peer Computing:
·         All nodes within the system are considered peers and each may act as either a client/server depending on whether it is requesting or providing a service.
·         Services can be provided by several nodes distributed throughout network.
·         A node is joined the network it can begin providing services to or requesting services from other nodes in the network.
1.12.4 Web –based computing:
·         Web computing has increased the emphasis on networking.
·         Load balancers which distribute network connections among a pool of similar servers.
·         Web has increased the complexity of devices.

2.1 operating System Services:
·         Os provides an environment for the execution of a program.
User Interface:
·         User interfaces are of
§  Command Line Interface
§  Batch Interface
§  Graphical User Interface

Command Line Interface:
§  It uses text command and a method for entering.
Batch interface:
§  Commands and directives to control those commands are entered into files and those files are executed.
Graphical Interface:
§  Interface is a window system with a pointing device to direct I/O.
·         Program Execution:
§  System must be able to load a program into memory and to run that program.
§  System must be able to end its execution either normally or abnormally.
·         I/O Operations:
§  It may require I/O which may involve a file or an I/O device.
·         File system Manipulation:
§  Programs need to read and write files and directories.
§  Programs need to create and delete them by name, search for a given file and list file information.
§   
·         Communications:
§  Process needs to exchange information with another process.
§  Communication may occur between processes that are executing on the same or different computer.
§  Implemented by shared memory or message passing.
·         Error Detection:
§  Os needs to be constantly aware of possible errors.
§  Errors may occur in CPU, memory hardware, I/O devices and user programs.
§  Debugging facilities enhance the users and programmers ability to use the system efficiently.
·         Resource Allocation:
§  Resources must be allocated to multiple users or jobs.
§  The resources are managed by Os.
·         Accounting:
§  Keep track of which users use how much and what kind of computer resource.
§  Usage statistics may be a valuable tool for researchers to reconfigure the system to improve computing services.
Protection and Security:
§  Protection involves ensuring that all access to system resources is controlled.
§  Security starts with each user to authenticate him or herself to the system usually by means of a password to gain access to system resources.
2.2 User Operating system Interface:
·         Command line or command interpreter that allows user to directly enter commands that are to be performed by this os.
·         It allows the user to interface with the os via a graphical user interface or GUI.
2.2.1 Command Interpreter:
§  Os include command interpreter in the kernel.
§  Systems with multiple command interpreters to choose from the interpreters are known as shells.
§  Windows xp and UNIX treat command interpreters as a special program that is running when a job is initiated.
§  The main function is to get and execute the next user specified command.
§  The command interpreter itself contains the code to execute the command.
§  UNIX os implements most commands through system programs
§  It uses the command to identify a file to be loaded into memory and executed.
§  E.g. rm file.txt(to delete file)
·         2.2.2 Graphical User Interface:
§  A GUI allows provides a mouse based windows and menu system as an interface.
§  It provides a desktop metaphor where the mouse is moved to position its pointer on images or icons on the screen.
§  The user interface can vary from system and even from user to user within a system.
§  The design of a useful and friendly user interface is therefore not a direct function of the os.
 

2.3 System Calls:
·         It provides an interface to the services made available by an os.
·         It can be available as routine written in c, c++ and assembly language instructions.
·         Systems execute thousands of system calls per second.
·         Application developers design program according to an application program interface (API).
·         The API specifies a set of functions that are available to an application Programmer.
·          
·         The  most common API’s are
§  Win32 API
§  POSIX API
§  Java API
·         Each os has its own name for each system call.
·         The runtime support system for most programming language provides a system call interface.
System call interface.
§  Serves as the link to system calls made available by os.
§  It intercepts function calls in the API and invokes the necessary system call within the os.
§  Most of the details of the os interface are hidden from the programmer by the API and are managed by the runtime support library.
2.4 Types of system calls:
2.4.1Process control:
·         A running program need to be able to halt its execution either normally (end) or abnormally (abort).
·         Debugger:  A system program designed to aid the programmer in finding and correcting bugs.
Control Card:
§  It is a batch system concept.
·         A processor job executing one program may want to load and execute another program.
·         Create a new job or process to be multi programmed (Create Process/Submit job).
·         To determine and reset the attributes of a job or process (get process attributes and set process attributes).
·         To terminate a job/process.
·         To wait for certain amount of time to pass (wait Time)
·         To wait for specific event to occur (wait event).
·         Process should then signal when that event has occurred (signal event).
·         To start a new process, the shell executes a fork () system call.
·         Selected program is loaded into memory via an exec () system call.
·         When the process is done, it executes an exit () system call to terminate.
2.4.2 File Management System:
·         Create and delete file
·         After creating, open it and use it.ie) read, write, and reposition the device.
·         Close a file.
·         Same can be done for directories.
·         Get and set file attributes.
2.4.3 Device management:
·         The system may require us to request the device to use it after finishing release it.
·         Once the device has been requested we can read, write and reposition the device.
2.4.4 Information Maintenance:
·         System calls used for the purpose of transferring information between user program and os.
·         System call can used to return current time and date.
·         it is also used to reset the process information by get process attributes and set process attributes.
2.4.5 Communication:
Message Passing:
§  The communicating process exchange messages with one another to transfer information.
§  Messages can be exchanged between the processes either directly or indirectly through a common mailbox.
§  A communication must be opened.
§  Connected by a communication n/w.
§  Each computer in an n/w has a host name.
§  A host also has an n/w identifier (IP address).
§  Each process has a process name.
§  The name is translated into an identifier by os can refer to the process.
§  For translation get host-id and get process-id system calls are used.
§  The source of the communication is known as the client.
§  The receiving daemon known as a server.
§  Messages can be exchanged using read message and write message system calls.
Shared memory:
§  Processors use shared memory create () and shared memory attach () to create and gain access to regions of memory owned by other process.
§  Information exchanged by reading and writing data in the shared areas.
2.5 System Programs:
·         System is the collection of system programs.
·         System program provides a convenient environment for program development and execution.
·         System programs can be divided into
File Management:
·         These programs create, delete, copy, rename, print, dump, list and generally manipulate files and directories.
Status Information:
·         It asks the system for date time, amount of available memory or disk space, number of users or similar status information.
·         It also provides performance, logging and debugging information.
File modification:
·         To create and modify the contents of files stored on disk or other storage devices.
·         Special commands to search contents of file or perform transformation of the text.
Programming –Language support:
·         Compilers, assemblers, debuggers, interpreter are provided to the user with the os.
Program Loading and Execution:
·         Program is assembled or compiled. It must be loaded into memory for execution.
·         It provides absolute loaders, re-locatable loaders, linkage editors and overlay loaders.
·         Communication:
·         Provide the mechanism for creating virtual connections among processes, users and computer system.
·         It allows user to send messages to one another.
2.6 Operating System design and implementation:
2.6.1 Design Goals:
·         In designing a system it is to define goals and specification.
·         The design of the system will be affected by the choice of hardware and the type of system.
·         The requirements can be divided into two groups
§  User goals
§  System goals
·         The system should be convenient to use, easy to learn and to use, reliable safe and fast.
·         The system should be easy to design, implement and maintain.
·         It should be flexible, reliable, error free and efficient.
·         Specifying and designing as os is a highly creative task.
2.6.2 Mechanism and Policies
Mechanisms:
§  It determines how to do something
Policies:
§  It determines what will be done.
·         The separation of policy and mechanism is important for flexibility.
·         Policies are likely to change across places or over time.
·         Each change in policy would require a change in the underlying mechanism.
·         Policy decisions are important for all resource allocation.
·         It is necessary to decide whether or not to allocate a resource, a policy decision is made.
2.6.3 Implementation:
·         After designing, it must be implemented.
·         Os have been written in assembly language. Now, most commonly in high level languages (c, c++…).
·         When high level languages are used in application programs. The code can be written faster, is more compact, and is easier to understand and debug.
·         Implementing os in high level language are reduced speed and increased storage requirements.

2.7 Operating System Structure:
·         Os must be engineered carefully.
·         Each component should be well-defined.
2.7.1 Simple Structure:
·         Os started as small, simple and limited systems and then grew beyond their original scope. Ex. MS-DOS.
·         In MS-DOS, the interfaces are levels of functionality are not well separated.
·         Application programs are able to access the basic I/O routines to write directly to display and disk drives.
·         It causes the entire system will be crashed when user program fail.
·         Refer Fig-MSDOS layer structure
·         Ex-UNIX
·         It was limited by hardware functionality.
·         It consists of
§  Kernel
§  System Program
·         The kernel is separated into
§  Series of interface
§  Device drivers
·         The kernel provides
§  File system
§  CPU  scheduling
§  Memory Management
§  Other os functions.
·         Refer fig: UNIX System Structure.
2.7.2 Layered Approach:
·         Os can be broken into pieces that are smaller and more appropriate.
·         Implementers have more freedom in changing the inner workings of the system and in creating modular os.
·         The overall features are determined and are separated into components.
Layered Approach:
·         In Which os is broken up into a number of layers (levels).
·         The bottom layer (0) is the Hardware.
·         The highest layer (N) is the user interface.
·         A typical layer, layer M consists of a data structure and a set of routines that can be invoked by higher-level layers.
·         Advantages:
§  Simplicity of construction and debugging.
§  It simplifies debugging and system verification.
·         A layer does not know how these operations are implemented.
·         It needs to know how these operations are implemented.
·         It needs to know only what these operations do.
·         Each layer hides the existence of certain data structures operations, hardware from higher layers.
·         Ref Fig: A Layered os
·         The difficulty involves appropriately defining the various layers.
·         The backing store driver would normally be above the CPU scheduler because the driver may need to wait for I/O and CPU can be rescheduled during this time.
·         It is tend to be less efficient than other types.
·         When user program executes an I/O operation, it executes a system call that is trapped to the I/O layer, which calls memory- management layer, which in turn calls the CPU scheduling layer which is then passed to the h/w.
2.7.3 Microkernel’s:
·         It structures the os by removing all non-essential components from the kernel and implementing them as user and system level programs.
·         The result is smaller kernel.
·         Micro kernel provides minimal process, memory management and communication facility.
·         It provides communication facility between the client and various services that are running in user space. – Message Passing.
·         It is ease of extending the os.
·         All new services are added to user space and consequently do not require modification of the kernel.
·         It provides more security and reliability.
·         It can suffer from performance decrease due to increased system function overhead.
2.7.4 Modules:
·         Os design involves using object oriented programming techniques to create a modular kernel.
·         The kernel has a set of  core components and dynamically links in additional service either during boot or during runtime.
·         A core kernel with seven types of loadable kernel modules.
§  Scheduling classes
§  File system
§  Loadable system calls
§  Executable formats
§  STREAMS modules
§  Miscellaneous
§  Device and bus drivers
·         A design allows the kernel to provide core services yet also allows certain features to be implemented dynamically.
·         The overall result resembles a layered system in that each kernel section  has defined, protected interfaces
·         It is more flexible than a layered system in that any module can call any other module.
·         Primary module has only core functions and knowledge of how to load & communicate with other modules.
·         It is more efficient.
·         Hybrid structure:
·         Ex- Mac OS x.
·         The top layer includes application environments & set of services providing a graphical interface to applications.
·         Kernel environment which consist of Mach microkernel and BSD kernel.
·         Mach provides memory management, support for RPCs (Remote Procedure Call), IPC (Inter-process Communication) including message passing & thread scheduling.
·         Ref fig
2.8 Virtual machine:
·         The fundamental idea behind a virtual machine is to abstract the h/w of a single computer into several different execution environment.
·         CPU scheduling & virtual memory techniques in an os can create the illusion that a process with its own virtual memory.
·         It provides an interface that is identical to the underlying bare h/w.
·         The virtual- machine approach involves disk systems.
·         The physical machine has three disk drives but wants to support seven virtual- machine.
·         It cannot allocate a disk drive to each virtual machine, the virtual machine s/w itself will need substantial disk space to provide virtual memory & spooling.
·         Ref. Fig 2.12.
·         Users are thus given their own virtual machines. They can run on any of the os or s/w packages that are available on the underlying machine.
2.8.1 Implementation:
·         It is useful, it is difficult to implement.
·         Machines has two modes
§  User mode
§  Kernel mode
·         The virtual machine s/w can run in kernel mode. It is the os.
·         The virtual machine itself can execute in only user mode.
·         We must have
§  Virtual user mode
§  Virtual kernel mode
·         Both of which run in a physical user mode.
·         The transfer from user mode to kernel on a real machine must also cause a transfer from virtual user mode to virtual kernel mode on a virtual machine.
2.3.2 Benefits:
·         It has the complete protection of the various system resources.
·         Each virtual machine is completely isolated from all other virtual machines.
·         There no direct sharing of resources.
·         It is possible to share a minidisk to share files.
·         It is possible to define an n/w of machines, to send information over the virtual communication n/w.
·         It is a perfect vehicle of os research & development.
·         Os runs on and controls the entire machine.
System development time:
·         The current system must be stopped & taken out of use which changes are made and tested.
·         2.8.3 Examples:

2.8.3.1 VMware
·         It runs as an application on a host os.
·         It allows host system to concurrently run several different guest os as independent virtual machines.
·         The programmer could test the application on a host os & on three guest os with each system running as a separate virtual machine.
·         EX:
§  Linux is running as host os, free BSD, Windows NT, windows XP are running as guest os.
§  The virtualization layer is the heart of VMware.
§  Each virtual machine has its own CPU, memory, disk drives, n/w interfaces.
§  Refer Fig-2.13 VMware Architecture.
2.8.3.2 The Java Virtual Machine:
·         Java provides a specification for a java virtual machine.
·         Java objects are specified with the class construct.
·         A java program consists of one or more classes.
·         The compiler produces an architectural- neutral byte code output.
·         It consists of a class loader & a java interpreter that executes architecture-neutral byte codes.
·         The byte code does not perform pointer arithmetic, which could provide illegal memory access.
·         JVM automatically manages memory by performing garbage collection.
·         The practice of reclaiming memory from object no longer in use & returning it to the system.
·         JVM may be implemented in s/w on top of a host os.

2.9 Operating System Generation:
·         It is possible to design code and implement an os specifically for one machine at one site.
·         Os are designed to run on any of a class of machines at a variety of sites with a variety of sites with a variety of peripheral configurations.
·         The system must then be configured or generated for each specific computer site, a process sometimes known as system generation (SYSGEN).
·         The SYSGEN program reads from a given file/ asks the operation of the system for information concerning the specific configuration of the hardware system.
1) What CPU is to be used? What options are installed?
2) How much memory is available?
3) What devices are available?
4) What os options are desired, or parameter values are to be used?
·         A system administrator can use it to modify a copy of the source code of the os.
·         The major differences among these approaches are the size & generality of the generated system and the case of modification as the h/w configuration changes.
2.10 System Boot:
·         The procedure of starting a computer by loading the kernel is known as booting the system.
·         A small piece of code known as the bootstrap program/bootstrap loader locates the kernel, loads it into main memory & starts its execution.
·         Two step process in which a simple bootstrap loader fetches a more complex boot program from disk, which in turn loads the kernel.
·         When a CPU receives a reset event, the instruction register is loaded with a predefined memory location & execution starts there.
·         It is to run diagnostics to determine the state of the machine.
·         The program stored in the boot block may be sophisticated enough to load the entire os into memory and begin its execution.
·         A disk has a boot partition is called a boot disk/ system disk.



0 comments: