Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
56 views19 pages

Os Unit 1

Uploaded by

Bindu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views19 pages

Os Unit 1

Uploaded by

Bindu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

OPERATING

MODULE 1

CHAPTER 1: INTRODUCTION

1.1 What is an Operating System?


 An Operating System(OS) acts as an intermediary between the user of a computer and the computer
hardware
 An operating system is a software that manages the computer hardware
 OS allows the user to execute programs in a convenient and efficient manner.
 An Operating System provides the environment within which programs are executed

Operating system goals:


 Make the computer system convenient to use. It hides the difficulty in managing the hardware.
 Use the computer hardware in an efficient manner
 Provide the environment in which user can easily interface with computer.
 It acts as a resource allocator

Components of Computer System (Computer System Structure)


 Computer system mainly consists of four components as shown in figure 1:
1 Hardware: Provides the basic computing resources for the system. It includes CPU, memory,
input/output (I/O) devices
2 Operating System: Controls and coordinates the use of hardware among the various applications
and users
3 Application Programs: Define the ways in which the system resources are used to solve the
computing problems of the users. It includes word processors, spreadsheets, compilers, web
browsers etc
4 Users: Can be people, machines, other components

Figure 1: Abstract view of the components of a computer system

 The basic hardware components comprises of CPU, memory, I/O devices. The application program
uses these components. The OS controls and co-ordinates the use of hardware, among various
application programs (like compiler, word processor etc.) for various users.
Page
OPERATING

 The OS allocates the resources among the programs such that the hardware is efficiently used.
 The operating system is the program running at all the times on the computer. It is usually called as the
kernel.

Views of OS
Operating System can be viewed from two viewpoints: User view and System view

1 User View: The user's view of the OS depends on the type of the user

 If the user is using standalone system, then OS is designed for ease of use and high performances.
Here resource utilization is not given importance.
 If the users are at different terminals connected to a mainframe or minicomputers, by sharing
information and resources, then the OS is designed to maximize resource utilization. OS is
designed such that the CPU time, memory and I/O are used efficiently and no single user takes
more than the resource allotted to them
 If the users are in workstations, connected to networks and servers, then the user have a dedicated
resources but also share resources such as networking and servers-files, print servers. Here the OS
is designed for both ease of use and resource availability (files).
 Users of hand held systems, expects the OS to be designed for ease of use and performance per
amount of battery life.
 Other systems like embedded systems used in home devices (like washing m/c) and automobiles
do not have any user interaction. They are connected to network either directly by wire or through
wireless modems and networking.

2 System View: OS can be viewed as a resource allocator and control program

 Resource allocator: The OS acts as a manager of hardware and software resources.(CPU time,
memory space, file-storage space, I/O devices, shared files etc. are the different resources required
during execution of a program) There can be conflicting request for these resources by different
programs running in same system. The OS assigns the resources to the requesting program
depending on the priority. Resource allocation is important when many users access the same
computer
 Control Program: The OS is a control program and manage the execution of user program to
prevent errors and improper use of the computer. It is concerned with the operation and control of
I/O devices

1.2 Types of Operating Systems

1 Mainframe Systems: It is the system where the first computer used to handle many commercial
scientific applications. The growth of mainframe systems traced from simple batch system-where
the computer runs one and only one application to time shared system-which allowed for user
interaction with the computer system
 Batch /Early System: Early computers were physically large machine. The common input
devices were card readers, tape drivers. The common output devices were line printers, tape
Page
OPERATING

drivers and card punches. In these systems the user did not interact directly with the computer
system. Instead the user used to prepare a job which consists of programming data and some
control information and then submitted it to the computer operator, after some time the output
appeared. The output in these early computer was fairly simple. But the main task was to transfer
the control automatically from one job to next. The operating system always resides in the
memory. To speed up processing, operators batched the jobs with similar needs and run together
as a group. The memory layout is shown in figure 2
 The disadvantages of batch system: Execution environment of the CPU is often idle because the
speed up of I/O devices is much slower than the CPU.

Figure 2: Memory layout of Simple Batch System

2 Multiprogrammed Systems: Multiprogramming increases CPU utilization by organizing the


jobs(tasks), so that the CPU always has one job to execute.
 The operating system keeps several jobs in memory simultaneously as shown in figure 3. Since
main memory is too small to accommodate all jobs, the jobs are kept initially in the job pool. The
OS picks and begins to execute jobs from job pool in memory.
 Sometimes, the job may have to wait for some task, such as an I/O operation, to complete. In this
environment, the operating system simply switches and executes another job. When a job needs to
wait, the CPU is simply switched to another job and so on.
 The multiprogramming operating system is sophisticated because the operating system makes
decisions for the user. If several jobs are ready to run at the same time the system choose one
among them. This is known as CPU scheduling.
 Advantage: Multiprogrammed systems provide an environment in which the various system
resources are utilized effectively
 Disadvantage: It does not provide user interaction with the computer system during the program
execution.

Figure 3: Memory layout for a multiprogramming system

Page
OPERATING

3 Time Sharing Systems: It is a logical extension of multiprogramming. It is also known as


multi-user system (multitasking system)
 CPU executes multiple jobs by switching among them, but the switches occur so frequently that
the users can interact with each program while it is running. The user feels that all the programs
are being executed at the same time
 It requires an interactive (or hands-on) computer system, which provides direct communication
between the user and the system
 The user gives instructions to the operating system or to a program directly, using a input device
such as a keyboard or a mouse, and waits for immediate results on an output device.
Accordingly, the response time should be short (less than one second).
 A time-shared OS allows many users to share the computer simultaneously. As the system
switches rapidly from one user to the next, each user is given the impression that the entire
computer system is dedicated to single user only, even though it is being shared among many
users.
 In a time-sharing system, the OS must ensure reasonable response time, which is accomplished
through swapping, where processes are swapped in and out of main memory to the disk. A
common method for achieving this goal is virtual memory.
 Advantage:
 Provide file system. The file system resides on a collection of disks; hence disk management
must be provided.
 Provide mechanism for protecting resources from inappropriate use
 To ensure orderly execution, the system must provide mechanisms for job synchronization
and communication.
 Disadvantage:
 The system must have memory management & protection, since several jobs are kept in
memory at the same time.
 It provides mechanism for concurrent execution which requires complex CPU scheduling
schemes.

4 Multiprocessor Systems (Parallel systems or Tightly coupled systems): These systems have two
or more processors in close communication, sharing the computer bus, the clock, memory, and
peripheral devices.
 Multiprocessor systems have three main advantages:
 Increased Throughput: Throughput is defined as number of processes computed per unit time.
By increasing the number of processors, the more work can be done in less time. In
multiprocessor system, execution of different programs take place simultaneously. Even if the
number of processors is increased the performance cannot be simultaneously increased. This
is due to the overhead incurred in keeping all the parts working correctly. The speed-up ratio
with N processors is not N, rather, it is less than N. Thus the speed of the system is not has
expected.
 Economy of Scale: Multiprocessor systems can cost less than equivalent multiple single-
processor systems. As the multiprocessor systems share peripherals, mass storage, and power

Page
OPERATING

supplies, the cost of implementing this system is economical. If several processes are working
on the same data, the data can also be shared among them
 Increased reliability: In multiprocessor systems, functions are shared among several
processors. If one processor fails, the system is not halted, it only slows down. The job of the
failed processor is taken up, by other processors. This ability to continue to operate in spite of
failure makes the system fault tolerant. Fault tolerance requires a mechanism to allow the
failure to be detected, diagnosed, and, if possible, corrected.
There are two types of multiprocessor systems
i Asymmetric Multiprocessing (Master-Slave Architecture) : Here each processor is
assigned a specific task, by the master processor. A master processor controls the other
processors in the system. It schedules and allocates work to the slave processors. This scheme
defines master-slave relationship.
Ex- Sun's Operating system : SUNOS version 4
ii Symmetric multiprocessing (SMP): The processors are considered as peers; no master-slave
relationship exists between processors. Each processor performs all tasks within the OS. All
the processors have its own registers and CPU, only memory is shared as shown in figure 4

Figure 4: Symmetric Multiprocessing Architecture

The benefit of this model is that many processes can run simultaneously. N processes can run if
there are N CPUs—without causing a significant deterioration of performance. Operating systems
like Windows, Windows XP, Mac OS X, and Linux—now provide support for SMP.

5 Distributed Systems: It is a collection of physically separate, heterogeneous computer systems that


are connected to provide the users to access various resources. Access to a shared resource increases
computation speed, functionality, data availability, and reliability.
 A network is a communication path between two or more systems. Distributed systems depend on
networking for their functionality. Networks vary by the protocols used, the distances between
nodes, and the transport media. TCP/IP is the most common network protocol. Most operating
systems support TCP/IP.
 Networks are characterized based on the distances between their nodes.
 A local-area network (LAN) connects computers within a room, a floor, or a building.

Page
OPERATING

 A wide-area network (WAN) usually links buildings, cities, or countries. A global company may
have a WAN to connect its offices worldwide.
 A metropolitan-area network (MAN) links buildings within a city
 A small-area network connects systems within a several feet using wireless technology. Eg.
Bluetooth and 802.11.
 The media to carry networks include copper wires, fibre strands, and wireless transmissions
between satellites, microwave dishes, and radios
 A network operating system is an operating system that provides features such as file sharing
across the network and that includes a communication scheme that allows different processes on
different computers to exchange messages.
 Advantage:
 Resource sharing, computation speed up, reliability, communication.
 A distributed OS provides a less autonomous environment: The different operating systems
communicate closely enough to provide the illusion that only a single OS controls the network

6 Real-Time Systems: Real time system is used when there are rigid time requirements on the
operation of a processor or flow of data.
 The OS of real-time embedded systems provide limited features. No user interface.
 Embedded systems always run real-time Operating Systems
 Sensors bring data to the computers. The computer analyses data and adjust the controls to modify
the sensor inputs.
 A real time OS has well defined fixed time constraints. Processing must be done within the time
constraint or the system will fail. A real time system is said to function correctly only if it returns
the correct result within the time constraint. These systems are characterized by having time as a
key parameter
Ex: System that controls scientific experiments, medical imaging systems and some display
systems are real time systems
 Disadvantage:
 A real time system is considered to function correctly only if it returns the correct result within
the time constraints
 Secondary storage is limited or missing, instead data is usually stored in short term memory or
ROM
 Advanced OS features are absent.
 Real time system is of two types:
 Hard real time systems: It guarantees that the critical task has been completed on time. The
sudden task is taken place at a sudden instant of time.
 Soft real time systems: It is a less restrictive type of real time system where a critical task gets
priority over other tasks and retains that priority until it computes. These have more limited
utility than hard real time systems. Digital audio or multimedia is included in this category.

Page
OPERATING

CHAPTER 2: OPERATING SYSTEM STRUCTURES

2.1 Operating System Components

1. Process Management

 A program under execution is a process.


 A process needs resources like CPU time, memory, files, and I/O devices for its execution. These
resources are given to the process when it is created or at run time. When the process terminates, the
operating system reclaims the resources.
 The program stored on a disk is a passive entity and the program under execution is an active entity.
 A single-threaded process has one program counter specifying the next instruction to execute. The
CPU executes one instruction of the process after another, until the process completes.
 A multithreaded process has multiple program counters, each pointing to the next instruction to
execute for a given thread.
 The OS is responsible for the following activities in connection with process management:
 Scheduling process and threads on the CPU
 Creating and deleting both user and system processes
 Suspending and resuming processes
 Providing mechanisms for process synchronization
 Providing mechanisms for process communication

2. Memory Management

 Main memory is a large array of words or bytes. Each word or byte has its own address.
 Main memory is the storage device which can be easily and directly accessed by the CPU.
 The central processor reads instructions from main memory during the instruction-fetch cycle and also
reads and writes data from main memory during data-fetch cycle.
 To improve both the utilization of the CPU and the speed of the computer's response to its users,
general-purpose computers must keep several programs in memory, creating a need for memory
management.
 The OS is responsible for the following activities in connection with memory management:
 Keeping track of which parts of memory are currently being used by user.
 Deciding which processes and data to move into and out of memory.
 Allocating and deallocating memory space as needed.

3. Storage Management

 There are three types of storage management


i) File system management
ii) Mass-storage management
iii) Cache management.

Page
OPERATING

File-System Management

 File management is one of the most visible component of an operating system.


 Computers can store information on several different types of physical media. Magnetic disk, optical
disk, and magnetic tape are the most common.
 Each of these media has its own characteristics and physical organization.
 A file is a collection of related information defined by its user.
 Commonly, files represent programs and data.
 Data files may be numeric, alphabetic, alphanumeric, or binary. Files may be free-form (for example,
text files), or they may be formatted rigidly (for example, fixed fields).
 Files are normally organized into directories to make them easier to use. When multiple users have
access to files, it may be desirable to control by whom and in what ways (read, write, execute) files
may be accessed.
 The OS is responsible for the following activities in connection with file management:
 Creating and deleting files
 Creating and deleting directories to organize files
 Supporting primitives for manipulating files and directories
 Mapping files onto secondary storage
 Backing up files on stable (nonvolatile) storage media

Mass- Storage Management

 Main memory is too small to accommodate all data and programs, and as the data that it holds are
erased when power is lost, the computer system must provide secondary storage to back up main
memory.
 Most modern computer systems use disks as the storage medium for both programs and data.
 Most programs including compilers, assemblers, word processors, editors, and formatters are stored on
a disk until loaded into memory and then use the disk as both the source and destination of their
processing.
 Hence, the proper management of disk storage is of central importance to a computer system.
 The operating system is responsible for the following activities in connection with disk management:
 Free-space management
 Storage allocation
 Disk scheduling
 As the secondary storage is used frequently, it must be used efficiently.
 The entire speed of operation of a computer may depend on the speeds of the disk.
 Magnetic tape drives and their tapes, CD, DVD drives and platters are tertiary storage devices.
 The functions that operating systems provides include mounting and unmounting media in devices,
allocating and freeing the devices for exclusive use by processes, and migrating data from secondary to
tertiary storage.

Page
OPERATING

Caching

 Caching is an important principle of computer systems.


 Information is normally kept in some storage system (such as main memory). As it is used, it is copied
into a faster storage system: the cache- as temporary data.
 When a particular piece of information is required, first we check whether it is in the cache. If it is, we
use the information directly from the cache; if it is not in cache, we use the information from the
source, putting a copy in the cache under the assumption that we will need it again soon.
 The internal programmable registers, like Index registers provide a high-speed cache for main
memory.
 Because caches have limited size, cache management is an important design problem.
 Careful selection of the cache size and page replacement policy can result in greatly increased
performance.
 The movement of information between levels of a storage hierarchy may be either explicit or implicit,
depending on the hardware design and the controlling operating-system software.
 For Ex, Data transfer from cache to CPU and registers is usually a hardware function, with no
operating-system intervention. In contrast, transfer of data from disk to memory is usually controlled
by the operating system.
 In a hierarchical storage structure, the same data may appear in different levels of the storage system.
For example, suppose to retrieve an integer A from magnetic disk to the processing program. The
operation proceeds by first issuing an I/O operation to copy the disk block on which A resides to main
memory. This operation is followed by copying A to the cache and to an internal register. Thus, the
copy of A appears in several places: on the magnetic disk, in main memory, in the cache, and in an
internal register as shown in figure 5



Figure 5: Migration of integer A from disk to register

 In a Multiprocessor environment, in addition to maintaining internal registers, each of the CPUs also
contains a local cache. In such an environment, a copy of A may exist simultaneously in several
caches. Since the various CPUs can all execute concurrently, any update done to the value of A in one
cache is immediately reflected in all other caches where A resides. This situation is called cache
coherency, and it is usually a hardware problem (handled below the operating-system level).

I/O Systems

 One of the purposes of an OS is to hide the peculiarities of specific hardware devices from the user.
 The I/O subsystem consists of several components:
 A memory-management component that includes buffering, caching, and spooling
 A general device-driver interface
 Drivers for specific hardware devices

Page
OPERATING

 Only the device driver knows the peculiarities of the specific device to which it is assigned.

4. Protection and Security

 If a computer system has multiple users and allows the concurrent execution of multiple processes,
then access to data must be regulated. Hence, a proper authorization has to be given by the OS for each
user
 Protection is a mechanism for controlling the access of processes or users to the resources defined by
a computer system. This mechanism must provide means for specification of the controls to be
imposed and means for enforcement.
 Protection improves reliability. A protection-oriented system provides a means to distinguish between
authorized and unauthorized usage.
 A system can have adequate protection but still be prone to failure and allow inappropriate access.
Consider a user whose authentication information is stolen. His/her data could be copied or deleted,
even though file and memory protection are working. It is the job of security to defend a system from
external and internal attacks. Such attacks spread across a huge range and include viruses and worms,
denial-of service attacks etc.
 Protection and security require the system to be able to distinguish among all its users.
 Most OS maintain a list of user names and associated user identifiers (user IDs). When a user logs in
to the system, the authentication stage determines the appropriate user ID for the user.
 Group functionality can be implemented with list of group names and group identifiers. A user can be
in one or more groups, depending on OS.

2.2 Operating System Services

 An operating system provides an environment for the execution of programs. It provides certain
services to programs and to the users of those programs.
 The specific services provided, differ from one OS to another
 The figure 6 shows one view of the OS service

Figure 6: A view of OS service

Page
OPERATING

 OS provide services (functions) that are helpful to the user, which includes:

 User Interface: Means by which users can issue commands to the system. Depending on the
operating system these may be a DTrace command-line interface (CLI), a Graphical User
Interface (GUI) or a Batch Command Interface.
In Command Line Interface(CLI)- commands are given to the system. In Batch interface-
commands and directives to control these commands are entered in a file and then the file is
executed. In GUI systems- windows with pointing device to get inputs and keyboard to enter the
text.

 Program Execution: The OS must be able to load a program into memory, run the program, and
terminate the program, either normally or abnormally.

 I/O Operations: The OS is responsible for transferring the data to and from I/O devices,
including keyboards, terminals, printers, and files. For specific devices, special functions (device
drivers) are provided by OS.

 File-System Manipulation: Programs need to read and write files or directories. The services
required to create or delete files, search for a file, list the contents of a file and change the file
permissions are provided by OS.

 Communications: Communication may occur when one process needs to exchange


information with another process. Such communication between the processes may takes place on
the same computer or between processes that are executing on different computer systems.
Communication may be implemented by OS via shared memory or through message passing.

 Error Detection: Both hardware and software errors must be detected and handled
appropriately by the OS. Errors may occur in the CPU and memory hardware (such as
power failure and memory error), in I/O devices (such as a parity error on tape, a connection
failure on a network, or lack of paper in the printer), and in the user program (such as an
arithmetic overflow, an attempt to access an illegal memory location).

 OS also provide services (functions) for the efficient operation of the system, which includes:

 Resource Allocation: Resources like CPU cycles, main memory, storage space, and I/O devices
must be allocated to multiple users and multiple jobs at the same time. The OS provide CPU-
scheduling routines that take into account the speed of the CPU, the jobs that must be executed,
the number of registers available etc.

 Accounting: There are services in OS to keep track of system activity and resource usage, either
for billing purposes or for statistical record keeping that can be used to optimize future
performance.

Page
OPERATING

 Protection and Security: The owners of information (file) in multiuser or networked computer
system may want to control the use of that information. When several separate processes execute
concurrently, one process should not interfere with other or with OS.
Protection involves ensuring that all access to system resources is controlled.
Security of the system from outsiders must also be done, by means of a password in order to
authenticate the user.

2.3 System Calls

 System calls is a means to access the services of the operating system.


 Generally written in C or C++, although some are written in assembly-language for optimal
performance.
 The below figure 7 illustrates the sequence of system calls required to copy a file content from one
file(input file) to another file (output file).

Figure 7: Example of how system calls are used

 For this, the program need names of two files: input file and output file. These names can be provided
in many ways.
 One approach: In interactive system, a sequence of system calls are required. First, to write a message
on the screen and then to accept the input filename from keyboard
 Second approach: In mouse-based and icon-based systems, a menu of filenames is displayed on the
screen. Then the user can use the mouse to select the source name and the destination name
 When the program tries to open the input file, it may find that there is no file of that name or that the
file is protected against access. In these cases, the program should print a message on the
console(another system call) and then terminate abnormally (another system call).
 If input file exists, then create a new output file (another system call). In this situation, we may find
that there is already an output file with the same name, which cause the program to abort (a system
call), or may delete the existing file (another system call) and create a new one (another system call)
Nandini S, Dept. of CSE
GITAM Uni ersit Bengal r Page
OPERATING

 Now that both the files are opened, we enter a loop that reads from the input file(another system call)
and writes to output file (another system call).
 Finally, after the entire file is copied, the program may close both files (another system call), write a
message to the console or window(system call), and finally terminate normally (final system call).
 Most programmers do not use the low-level system calls directly, but instead use an "Application
Programming Interface", API.
 The API specifies a set of functions that are available to an application programmer, including the
parameters that are passed to each function and the return values the programmer can expect
 The APIs instead of direct system calls provides for greater program portability between different
systems. The API then makes the appropriate system calls through the system call interface, using a
system call table to access specific numbered system calls, as shown in Figure 8
 Typically, a number is associated with each system call, and the system-call interface maintains a table
indexed according to these numbers
 The system call table (consisting of system call number and address of the particular service) invokes a
particular service routine for a specific system call.
 The caller need know nothing about how the system call is implemented or what it does during
execution.

Figure 8: The handling of a user application invoking the open( ) system call

 Three general methods used to pass parameters to OS are –


 To pass parameters in registers
 Parameters are stored in a blocks, or table, in memory and the address of block is passed as a
parameter in a register as shown in Figure 9. (Ex: Linux & Solaris).
 Parameters can be pushed onto the stack by program and popped off the stack by OS.
 Some OS prefer the block or stack method because those approaches do not limit the number or length
of parameters being used.

Page
OPERATING

Figure 9: Passing of parameters as a table


2.4 System Programs

 A collection of programs that provide a convenient environment for program development and
execution (other than OS) are called system programs or system utilities.
 It is not a part of Kernel or command interpreters
 System programs are divided into following categories:

 File Management: These programs create, delete, copy, rename, print & manipulate files and
directories
 Status Information: Utilities to check on the date, time, number of users, processes running, data
logging, etc. System registries are used to store and recall configuration information for particular
applications.
 File Modification: Text editors are available to create and modify the contents of file stored on
disk. Special commands can also be used to search contents of files or perform text manipulation
on files
 Programming-Language Support: Compliers, assemblers & interpreters are provided to the user
with the OS
 Program loading and Execution: Once a program is assembled or compiled, it must be loaded
into memory to be executed. The OS provide absolute loaders, relocatable loaders, linkage editors,
overlay loaders etc
 Communications: Programs provide the mechanism for creating virtual connections among
processors, users, and computer systems. It also includes sending electronic mail messages, to
browse web page, remote logins, file transfers, and remote command execution
 Application Programs: Most OS provide programs that are useful to solve common problems or
to perform common operations. Ex: web browsers, word processors & text formatters etc.

 The view of the OS seen by most users is defined by the application and system programs, rather than
by actual system calls

Page
OPERATING

2.5 Operating System Structure

 OS structure must be carefully designed. The task of OS is divided into small components and then
interfaced to work together.

1) Simple Structure

 Many operating systems do not have well-defined structures. They started as small, simple, and
limited systems and then grew beyond their original scope. Eg: MS-DOS.
 In MS-DOS, the interfaces and levels of functionality are not well separated as shown in Figure 10
 Application programs can access basic I/O routines to write directly to the display and disk drives.
Such freedom leaves MS-DOS in bad state and the entire system can crash down when user
programs fail.
 UNIX OS consists of two separable parts: the kernel and the system programs. The kernel is
further separated into a series of interfaces and device drivers.

Figure 10 : MS-DOS Layer Structure

 But the traditional UNIX operating System is layered as shown in Figure 11.
 Everything below the system-call interface and above the physical hardware is the kernel.
 The kernel provides the file system, CPU scheduling, memory management, and other operating-
system functions through system calls

Page
OPERATING

Figure 11: Traditional UNIX system structure

2) Layered Approach

 The OS is broken into number of layers (levels). Each layer rests on the layer below it, and relies
on the services provided by the next lower layer.
 Bottom layer(layer 0) is the hardware and the topmost layer (layer N) is the user interface as
shown in Figure 12
 A typical layer, consists of data structure and routines that can be invoked by higher-level layer.
 Under a top-down approach, the overall functionality and features are determined and are
separated into components.
 A OS layer is an implementation of an abstract object made up of data and the operations that can
manipulate those data

 Advantages:
 Simplicity of construction and debugging
 The layers are selected such that each uses functions and services of only lower-level layers.
Hence simplifies debugging and system verification i.e., the first layer can be debugged without
concerning the rest of the system. Once the first layer is debugged, its correct functioning is
assumed while the 2nd layer is debugged & so on.
 If an error is found during the debugging of a particular layer, the error must be on that layer
because the layers below it are already debugged. Thus the design & implementation of the
system are simplified when the system is broken down into layers.
 A layer doesn‘t need to know how these operations are implemented; it only needs to know
what these operations do.

 Disadvantages:
 The various layers must be appropriately defined, as a layer can use only lower level layers.
 Less efficient than other types, because any interaction with layer 0 required from top layer.
The system call should pass through all the layers and finally to layer 0. This is an overhead.

Page
OPERATING

Figure 12: A Layered OS

3) Microkernels

 The basic idea behind micro kernels is to remove all non-essential services from the kernel, thus
making the kernel as small and efficient as possible.
 The removed services are implemented as system applications(user space)
 Most microkernels provide basic process and memory management, and message passing between
other services.
 Benefit: To provide communication facility between the client program and the various services
that are running in user space. Communication is provided by message passing
 Mach was the first and most widely known microkernel, and now forms a major component of
Mac OS X.

 Advantages:
 System expansion can be easier, because it only involves adding more system applications, not
rebuilding a new kernel.
 When the kernel does not have to be modified, the changes are fewer, because the microkernel
is a smaller kernel
 Hence microkernel is smaller kernel
 The microkernel OS is easier to port from one hardware design to another
 Provides more security and reliability, since most services are running as user programs rather
than kernel processes.

 Disadvantages:
 Performance is reduced due to increased system function overhead

4) Modules

 Modern OS development is object-oriented, with a relatively small core kernel and a set of
modules which can be linked in dynamically.

Page
OPERATING

 For Example: The Solaris OS structure shown in figure 13 is organized around a core kernel with
7 types of loadable kernel modules:
 Scheduling Classes
 File Systems
 Loadable System calls
 Executable formats
 STREAMS modules
 Miscellaneous
 Device and bus drivers

Figure 13: Solaris Loadable Modules

 Modules are similar to Layered systems in that each subsystem has clearly defined tasks and
interfaces, but any module is free to contact any other module, eliminating the problems of going
through multiple intermediary layers
 The kernel is relatively small in this architecture, similar to microkernels, but the kernel does not
have to implement message passing since modules are free to contact each other directly. Eg:
Solaris, Linux and Mac OS X
 The Apple Mac OS X Operating system uses a hybrid structure. It is a layered system in which
one layer consists of the Mach microkernel as shown in Figure 14

Figure 14: The Mac OS X Structure


 The top layers include application environments and set of services providing graphical interface to
applications

Page
OPERATING

 Below these layers is the kernel environment, which consists primarily of the Mach microkernel and
the BSD kernel.
 Mach provides memory management, support for remote procedure calls (RPCs) and interprocess
communication (IPC) facilities.
 The BSD component provides a BSD command line interface, support for networking and file systems
etc.

 Advantages:

 Resembles a layered system, in which a module can call any other module
 Resembles microkernel approach, in which primary module has only core functions and
knowledge of how to load and communicate with other modules; but it is more efficient, because
modules do not need to invoke message passing in order to communicate

Page

You might also like