Unit 3 Introduction To Operating System Concepts

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

UNIT – I Introduction to Operating System Concepts

INTRODUCTION
Operating System:
An Operating System is a program that manages the computer hardware. It also provides a basis for
application programs and act as an intermediary between the computer user and the computer hardware.
An amazing aspect of operating systems is how they vary in accomplishing these tasks. Mainframe
operating systems are designed primarily to optimize utilization of hardware. Personal computer (PC)
operating systems support complex games, business applications, and everything in between. Operating
systems for mobile computers provide an environment in which a user can easily interface with the
computer to execute programs. Thus, some operating systems are designed to be convenient, others to be
efficient, and others to be some combination of the two.

Fig1.1: Abstract view of the components of a computer system


A computer system can be divided roughly into four components: the hardware, the operating system,
the application programs, and the users as shown in the figure 1.1. The hardware - the central
processing unit (CPU), the memory, and the input/output (I/O) devices-provides the basic computing
resources for the system. The application programs-such as word processors, spreadsheets, compilers,
and Web browsers-define the ways in which these resources are used to solve users’ computing
problems. The operating system controls the hardware and coordinates its use among the various
application programs for the various users.
Users View:
The user’s view of the computer varies according to the interface being used. Most computer users sit in
front of a PC. The goal is to maximize the work that the user is performing. In this case, the operating
system is designed mostly for ease of use, with some attention paid to performance and none paid to
resource utilization i.e. how various hardware and software resources are shared. Such systems are
optimized for the single-user experience rather than the requirements of multiple users.

@Ajay Kumar Badhan Page 1


UNIT – I Introduction to Operating System Concepts

In other cases, a user sits at a terminal connected to a mainframe or a minicomputer. Other users are
accessing the same computer through other terminals. These users share resources and may exchange
information. The operating system in such cases is designed to maximize resource utilization to assure
that all available CPU time, memory, and I/O are used efficiently.
In still other cases, users sit at workstations connected to networks of other workstations and servers.
These users have dedicated resources at their disposal, but they also share resources such as networking
and servers, including file, compute, and print servers. Therefore, their operating system is designed to
compromise between individual usability and resource utilization.
Most mobile computers are standalone units for individual users. They are connected to networks
through cellular or other wireless technologies. Increasingly, these mobile devices are replacing desktop
and laptop computers for people who are primarily interested in using computers for e-mail and web
browsing.
Systems View:
As per computer’s point of view, the operating system is defined as:
 Resource Allocator
 Control Program
1. Resource Allocator: A computer system has many resources that may be required to solve a
problem: CPU time, memory space, file-storage space, I/O devices, and so on. The operating
system acts as the manager of these resources. Facing numerous and possibly conflicting requests
for resources, the operating system must decide how to allocate them to specific programs and
users so that it can operate the computer system efficiently and fairly.
2. Control Program: It manages the execution of the user programs to prevent errors and improper
use of the computer. It is especially concerned with the operation and control of I/O devices.
TYPES OF OPERATING SYSTEM:
There are several different types of operating system exists. They are:
1. Mainframe systems 2. Multiprocessor systems
3. Clustered Systems 4. Distributed Systems
5. Real Time systems
1. Mainframe Systems: These are the first computers used to tackle many commercial and scientific
applications.
 Batch Systems: Early computers were enormous machines run from the console. The
common input devices were card readers and tape drivers. The common output devices
were line printers, tape drivers and card punches. The user used to prepare a job which
consists of the program, the data and some control information. It is submitted to the

@Ajay Kumar Badhan Page 2


UNIT – I Introduction to Operating System Concepts

system and sometime later output appeared. The output consists of the result of the
program as well as the dump of the final memory and register contents for debugging.
To speed this process operators batched together the jobs with similar needs and ran them
through the computer as a group. Thus the programmer leaves the programs with the
operators. The operator grouped the programs into batches with similar requirements and as
the computer became available, would run each batch.
Operating System

User Program
Area

Memory Layout of simple batch system


 Multi-programmed Systems: This system increases CPU utilizations by organizing jobs
so that the CPU always has one to execute. The basic idea is: the operating system keeps
several jobs in memory simultaneously. This set of jobs is a subset of jobs kept in the job
pool. The operating system picks and begins to execute one of the jobs in the memory.
When the job may have to wait for some task or I/O operations to complete, the operating
system simply switches to and execute the another job. When that job needs to wait, the
CPU is switched to another job and so on. Eventually the first job finishes waiting and gets
the CPU back as long as at-least one job need to execute, the CPU is never idle.
Operating System
JOB 1
JOB2
JOB3
JOB4
Memory Layout for Multiprogramming System
 Time Sharing Systems: It is also called as multitasking. It’s a logical extension of
multiprogramming. In time sharing the CPU executes multiple jobs by switching among
them, but the switching occurs so frequently that the user can interact with each program
while it is running. It requires an interactive computer system, which provides direct
communication between the user and the system. It uses the CPU scheduling and
multiprogramming to provide each user with a small portion of a time shared computer.
Each user has at-least one separate program in memory. A program loaded into the memory
and executing is called a process. It executes only for a short time before it either finishes
or needs to perform I/O.

@Ajay Kumar Badhan Page 3


UNIT – I Introduction to Operating System Concepts

In time sharing systems, the operating system must ensure reasonable response time, which
is sometimes accomplished through swapping, where processes are swapped in and out of
the main memory to the disk. A more common method to achieve this is Virtual Memory,
a technique that allows the execution of the process that is not completely in memory. It
enable user to run programs that are larger than the actual physical memory. The main
advantage of the virtual memory is that programs can be larger than physical memory
Time sharing systems must also provide a file system. It resides on the collection of disks,
hence disk management must be provided. It also provides a mechanism for concurrent
execution, which required sophisticated CPU Scheduling Schemes.
2. Multiprocessor Systems: These are also known as parallel systems or multi-core systems. Such
systems have two or more processors in close communication, sharing the computer bus and
sometimes the clock, memory and peripheral devices. They generally have three main advantages:
 Increased Throughput: By increasing the number of processors the more amount of work
will be done in less time. When multiple processors cooperate on a task, certain amount of
overhead is incurred in keeping all the parts working correctly. This overhead lowers the
expected gain from additional processors.
 Economy of Scale: Multiprocessor systems can cost less than equivalent multiple single-
processor systems, because they can share peripherals, mass storage, and power supplies. If
several programs operate on the same set of data its cheaper to store those data on the disk.
 Increased Reliability: If functions can be distributed properly among several processors, then
the failure of one processor will not halt the system, only slow it down. If we have ten
processors and one fails, then each of the remaining nine processors can pick up a share of the
work of the failed processor.
The multiprocessor systems in use are of two types: asymmetric and symmetric
In asymmetric multiprocessing (ASMP) system each processor is assigned a specific task. A master
processor control the system, the other processor either looks to the master for instructions or have
predefined tasks. It defines the master-slave relationship. The master process schedules and allocates
work to slave processes.
In symmetric multiprocessing (SMP) system each processor runs identical copy of the operating
system and these copies communicate with one another as needed. Fig 1.2 represents the SMP
architecture. Each processor has its own set of registers, as well as private or local cache.

@Ajay Kumar Badhan Page 4


UNIT – I Introduction to Operating System Concepts

Fig 1.2: SMP architecture


3. Clustered Systems: Another type of multiprocessor system is clustered systems, which gathers
together multiple CPUs. They usually provide high availability services i.e. services will continue
even if one or more systems in the cluster fail. Clustering can be structured asymmetrically or
symmetrically. In asymmetric clustering one machine is in hot standby mode while others will be
running the application. The hot-standby host machine does nothing but monitor the active server.
If that server fails, the hot-standby host becomes the active server. In symmetric clustering, two
or more hosts are running applications and are monitoring each other. This structure is obviously
more efficient, as it uses all of the available hardware. However it does require that more than one
application be available to run.
4. Distributed Systems: It is a collection of physically separate, possibly heterogeneous computer
systems that are networked to provide the users with access to the various resources that the
system maintains. Accesses to shared resources increases computation speed, functionality, data
availability, and reliability.
A network, in the simplest terms, is a communication path between two or more systems.
Distributed systems depend on networking for their functionality. Networks vary by the protocols
used, the distance between the nodes and the transport media. TCP/IP is the most common network
protocol.
Networks are classified based on the distance between their nodes. They are basically of three
types. They are:
 Local Area Network (LAN) Wide Area Network (WAN)
 Metropolitan area network (MAN)
1. Local Area Network (LAN): It connects computer within a room, a floor, or a building.
2. Wide Area Network (WAN): It usually links building, cities or countries. A global company
may have a WAN to connect to it offices worldwide. These networks may run one protocol or
several protocols.
3. Metropolitan Area Network (MAN): It could link buildings within a city
Bluetooth and 802.11 devices use wireless technologies to communicate over a distance of several
feet, in essence creating a small area network.

@Ajay Kumar Badhan Page 5


UNIT – I Introduction to Operating System Concepts

5. Real Time Systems: A real time system is used when rigid time requirements have been placed on
the operation of the processor or the flow of data. Thus it is often used as a control device in
dedicated applications. Sensors bring data to the computer. The computer must analyze the data
and possibly adjust controls to modify the sensor input. Systems that control scientific
experiments, industrial control systems and certain display systems are real time systems.
A real time system has well defined fixed time constraints. Processing must be done within the
defined constraints, or the system will fail. A real time system functions correctly only if it returns
the correct result within its time constraints.
Real time systems are basically classified into two types. They are:
a. Hard Real Time Systems: It guarantees that critical task be completed on time. In this
system secondary storage is limited or missing and the data is stored in ROM. Virtual
memory is not found on real time systems. Therefore hard real time conflicts with the
operations of time sharing systems, and the two cannot be mixed.
b. Soft Real Time Systems: These are less restrictive. A critical real time task gets priority
over other tasks and retains the priority until it completes. These have limited utility than
hard real time systems. These are risky to use in industrial applications where fixed time
constraints are imposed. They are useful in several areas such as: multimedia, virtual
reality, etc.
OPERATING SYSTEM OPERATIONS:
Modern operating systems are interrupt driven. Events are signaled by the occurrence of an interrupt or
a trap. A trap (or an exception) is a software-generated interrupt caused either by an error (for example,
division by zero or invalid memory access) or by a specific request from a user program that an
operating-system service be performed. For each type of interrupt, separate segments of code in the
operating system determine what action should be taken. An interrupt service routine is provided to deal
with the interrupt.
Dual Mode and Multimode Operation:
In order to ensure the proper execution of the operating system, distinguishing between the execution of
operating-system code and user defined code should be done. The approach taken by most computer
systems is to provide hardware support that allows us to differentiate among various modes of
execution. In general there are two different types of modes:
 User Mode
 Kernel Mode (also called supervisor mode, system mode or privileged mode)
A bit, called mode bit, is added the hardware of the computer to indicate the current mode: kernel (0) or
user (1). When the computer system is executing on behalf of the user application, the system is in user

@Ajay Kumar Badhan Page 6


UNIT – I Introduction to Operating System Concepts

mode. However when a user application requests a service from the operating system, the system must
transition from user to kernel mode to fulfill the request. This is shown in the figure 1.3:

Fig 1.3: Transition from user mode to kernel mode


At system boot time, the hardware starts in kernel mode. The operating system is then loaded and starts
user applications in user mode. Whenever a trap or interrupt occurs, the hardware switches from user
mode to kernel mode (that is, changes the state of the mode bit to 0). Thus, whenever the operating
system gains control of the computer, it is in kernel mode. The system always switches to user mode (by
setting the mode bit to 1) before passing control to a user program.
Timer:
The operating system must maintain a control over the CPU. It cannot allow the user program to stuck in
an infinite loop or fail to call system services and never return control to the operating system. To
accomplish this goal we use timer. A timer can be set to interrupt the computer after a specified period.
The period may be fixed or variable. A “variable timer” is generally implemented by a fixed rate clock
and a counter. The operating system sets the counter. Every time the clock ticks, the counter is
decremented. When the counter reaches 0, an interrupt occurs. Before turning over the control to the
user, the operating system ensures that the timer is set to interrupt.
Timers can also be used to prevent the user program from running too long. A simple technique is to
initialize the counter with the amount of time that a program is allowed to run.
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 may differ from one
operating system to another. These operating system services are provided for the convenience of the
programmer, to make the programming task easier. There are several different types of services that are
provided. They are:
 User Interface
 Program Execution
 I/O operations
 File System manipulation

@Ajay Kumar Badhan Page 7


UNIT – I Introduction to Operating System Concepts

 Communication
The below figure 1.4 shows one view of the various operating system services:

Fig 1.4: View of Operating system Services


1. User Interface: Almost all operating systems have a user interface (UI). This interface can take
several forms. One is a command-line interface (CLI), which uses text commands and a method
for entering them (say, a keyboard for typing in commands in a specific format with specific
options). Another is a batch interface, in which commands and directives to control those
commands are entered into files, and those files are executed. Most commonly, a graphical user
interface (GUI) is used. Here, the interface is a window system with a pointing device to direct
I/O, choose from menus, and make selections and a keyboard to enter text. Some systems provide
two or all three of these variations.
2. Program Execution: The system must be able to load a program into memory and run that
program. The program must be able to end its execution, either normally or abnormally (indicating
error).
3. I/O Operations: A running program may require I/O, which may involve a file or an I/O device.
For specific devices, special functions may be desired (such as recording to a CD or DVD drive or
blanking a display screen). For efficiency and protection, users usually cannot control I/O devices
directly. Therefore, the operating system must provide a means to do I/O.
4. File System Manipulation: The file system is of particular interest. Obviously, programs need to
read and write files and directories. They also need to create and delete them by name, search for a
given file, and list file information. Finally, some operating systems include permissions
management to allow or deny access to files or directories based on file ownership. Many
operating systems provide a variety of file systems, sometimes to allow personal choice and
sometimes to provide specific features or performance characteristics.

@Ajay Kumar Badhan Page 8


UNIT – I Introduction to Operating System Concepts

5. Communications: There are many circumstances in which one process needs to exchange
information with another process. Such communication may occur between processes that are
executing on the same computer or between processes that are executing on different computer
systems tied together by a computer network. Communications may be implemented via shared
memory, in which two or more processes read and write to a shared section of memory, or
message passing, in which packets of information in predefined formats are moved between
processes by the operating system.
6. Error Detection: The operating system needs to be detecting and correcting errors constantly.
Errors may occur in the CPU and memory hardware (such as a memory error or a power failure),
in I/O devices (such as a parity error on disk, 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, or a too-great use of CPU time). For each type of error, the operating
system should take the appropriate action to ensure correct and consistent computing.
Another set of operating system functions exists not for helping the user but rather for ensuring the
efficient operation of the system itself. Systems with multiple users can gain efficiency by sharing
the computer resources among the users.
7. Resource Allocation: When there are multiple users or multiple jobs running at the same time,
resources must be allocated to each of them. The operating system manages many different types
of resources. Some (such as CPU cycles, main memory, and file storage) may have special
allocation code, whereas others (such as I/O devices) may have much more general request and
release code. For instance, in determining how best to use the CPU, operating systems have CPU-
scheduling routines that take into account the speed of the CPU, the jobs that must be executed, the
number of registers available, and other factors. There may also be routines to allocate printers,
USB storage drives, and other peripheral devices.
8. Accounting: At times the system needs to keep track of which users use how much and what kinds
of computer resources. This record keeping may be used for accounting (so that users can be
billed) or simply for accumulating usage statistics.
9. Protection and Security: The owners of information stored in a multiuser or networked computer
system may want to control use of that information. When several separate processes execute
concurrently, it should not be possible for one process to interfere with the others or with the
operating system itself. Protection involves ensuring that all access to system resources is
controlled. Security of the system from outsiders is also important. Such security starts with
requiring each user to authenticate himself or herself to the system, usually by means of a

@Ajay Kumar Badhan Page 9


UNIT – I Introduction to Operating System Concepts

password, to gain access to system resources. If a system is to be protected and secure, precautions
must be instituted throughout it.
INTRODUCTION TO SYSTEM CALLS:
System Calls: System calls provide an interface to the services made available by an operating system.
These calls are generally available as routines written in C and C++, although certain low-level tasks
may have to be written using assembly-language instructions.
Example on How System calls are used:
Writing a simple program to read data from one file and copy them to another file.
1. The first input that the program will need is the names of the two files: the input file and the output
file. These names can be specified in many ways, depending on the operating-system design. One
approach is for the program to ask the user for the names. In an interactive system, this approach
will require a sequence of system calls, first to write a prompting message on the screen and then
to read from the keyboard the characters that define the two files.
2. Once the two file names have been obtained, the program must open the input file and create the
output file. Each of these operations requires another system call. Possible error conditions for
each operation can require additional system calls.
3. When both files are set up, we enter a loop that reads from the input file a system call) and writes
to the output file (another system call). Each read and write must return status information
regarding various possible error conditions. On input, the program may find that the end of the file
has been reached or that there was a hardware failure in the read (such as a parity error). The write
operation may encounter various errors; depending on the output device (for example, no more
disk space).
4. Finally, after the entire file is copied, the program may close both files (another system call), write
a message to the console or window (more system calls), and finally terminate normally (the final
system call). This system-call sequence is shown in Figure 1.5.

@Ajay Kumar Badhan Page 10


UNIT – I Introduction to Operating System Concepts

Fig 1.5: Example of how system calls are used

Types of System Calls:


System calls can be grouped roughly into six major categories. They are:
1. Process control, 4. Information maintenance,
2. File manipulation, 5. Communications, and
3. Device manipulation, 6. Protection.
In each category there are certain types of system calls that are provided. They are as follows:
1. Process Control:
 end, abort
 load, execute
 create process, terminate process
 get process attributes, set process attributes
 wait for time
 wait event, signal event
 allocate and free memory
2. File Management:
 create file, delete file
 open, close
 read, write, reposition
 get file attributes, set file attributes
3. Device Management:
 request device, release device
 read, write, reposition
 get device attributes, set device attributes
 logically attach or detach devices
4. Information Management:
 get time or date, set time or date
 get system data, set system data
 get process, file, or device attributes
 set process, file, or device attributes
5. Communications
 create, delete communication connection
 send, receive messages

@Ajay Kumar Badhan Page 11


UNIT – I Introduction to Operating System Concepts

 transfer status information


 attach or detach remote devices

Process Control:
A running program needs to be able to halt its execution either normally (end()) or abnormally (abort()).
If a system call is made to terminate the currently running program abnormally, or if the program runs
into a problem and causes an error trap, a dump of memory is sometimes taken and an error message
generated. The dump is written to disk and may be examined by a debugger: a system program
designed to aid the programmer in finding and correcting errors or bugs to determine the cause of the
problem. Under either normal or abnormal circumstances, the operating system must transfer control to
the invoking command interpreter
The command interpreter then reads the next command. In an interactive system, the command
interpreter simply continues with the next command assuming that the user will issue an appropriate
command to respond to any error.
If a new job or process is created or a set of process are created, the user should be able to control its
execution. It requires the abilities to determine and reset the attributes of a job or a process. So
get_process_attributes() and set_process_attributes() system calls are used. The created process may
also be terminated using terminate_process() system call.
File Management:
Files can be created and deleted using create() and delete() system calls. Either system call requires the
name of the file and perhaps some of the file’s attributes. Once the file is created, we need to open() it

@Ajay Kumar Badhan Page 12


UNIT – I Introduction to Operating System Concepts

and to use it. We may also read(), write(), or reposition() (rewind or skip to the end of the file, for
example). Finally, we need to close() the file, indicating that we are no longer using it.
The same set of operations can be used for directories if there is a directory structure for organizing file
in the file system. For either files or directories various attributes need to be determined. File attributes
include the file name, file type, protection codes, accounting information, and so on. At least two
system calls, get file attributes() and set file attributes(), are required for this function. Some operating
systems provide many more calls, such as calls for file move() and copy().
Device Management:
A process may need several resources to execute – main memory, disk drivers, and access to files and
so on. If the resources are available they can be granted, and the control can be returned to the user
process. Otherwise the process has to wait until sufficient resources are available.
The various resources controlled by the operating system can be thought of as devices. Some of these
devices are physical devices (for example, disk drives), while others can be thought of as abstract or
virtual devices (for example, files).A System with multiple users may require us to first request() a
device, to ensure exclusive use of it. After we are finished with the device, we release() it. These
functions are similar to the open() and close() system calls for files. Other operating systems allow
unmanaged access to devices.
Information Maintenance:
Many system calls exist for the purpose of transferring information between the user program and the
operating system. For example, most systems have a system call to return the current time() and date().
Other system calls may return information about the system, such as the number of current users, the
version number of the operating system, the amount of free memory or disk space, and so on.
Another set of system calls is helpful in debugging a program. Many systems provide system calls to
dump() memory. This provision is useful for debugging. A program trace lists each system call as it is
executed. Even microprocessors provide a CPU mode known as single step, in which a trap is executed
by the CPU after every instruction. The trap is usually caught by a debugger.
Communication:
There are two common models of inter-process communication. They are:
 The message passing model and
 The Shared memory model
1. The Message Passing Model: In the message-passing model, the communicating processes
exchange messages with one another to transfer information. Messages can be exchanged between
the processes either directly or indirectly through a common mailbox. Before communication can
take place, a connection must be opened. The name of the other communicator must be known.
Each computer in a network has a host name. A host also has a network identifier, such as an

@Ajay Kumar Badhan Page 13


UNIT – I Introduction to Operating System Concepts

IP address. Similarly, each process has a process name, and this name is translated into an
identifier by which the operating system can refer to the process. The get hostid() and get
processid() system calls do this translation. The identifiers are then passed to the general purpose
open() and close() calls provided by the file system or to specific open connection() and close
connection() system calls, depending on the system’s model of communication. The recipient
process usually must give its permission for communication to take place with an
accept_connection() call. Most processes that will be receiving connections are special-purpose
daemons, which are system programs provided for that purpose. They execute a
wait_for_connection() call and are awakened when a connection is made. The source of the
communication, known as the client, and the receiving daemon, known as a server, then exchange
messages by using read_message() and write_message() system calls. The close_connection() call
terminates the communication.
2. The Shared Memory Model: In the shared-memory model, processes use shared memory create()
and shared memory attach() system calls to create and gain access to regions of memory owned by
other processes. In general the operating system tries to prevent one process from accessing
another process’s memory Shared memory requires that two or more processes agree to remove
this restriction. They can then exchange information by reading and writing data in the shared
areas. The processes are also responsible for ensuring that they are not writing to the same location
simultaneously.
Note: Message passing is useful for exchanging smaller amounts of data, because no conflicts need be
avoided. It is also easier to implement than is shared memory for inter-computer communication. Shared
memory allows maximum speed and convenience of communication, since it can be done at memory
transfer speeds when it takes place within a computer.
OPERATING SYSTEM STRUCTURE:
A system as large and complex as a modern operating system must be engineered carefully if it is to
function properly A common approach is to partition the task into small components, or modules, rather
than have one monolithic system. Each of these modules should be a well-defined portion of the system,
with carefully defined inputs, outputs, and functions.
Simple Structure:
Many operating systems do not have well-defined structures. Frequently, such systems started as small,
simple, and limited systems and then grew beyond their original scope. MS-DOS is an example of such
a system. It was originally designed and implemented by a few people who had no idea that it would
become so popular. It was written to provide the most functionality in the least space, so it was not
carefully divided into modules. Figure 1.6 shows its structure.

@Ajay Kumar Badhan Page 14


UNIT – I Introduction to Operating System Concepts

Fig 1.6: MS-DOS layer architecture


In MS-DOS, the interfaces and levels of functionality are not well separated. For instance, application
programs are able to access the basic I/O routines to write directly to the display and disk drives. It leads
to malicious programs, causing entire system crash when user programs fail. It is also limited by the
hardware of its era. Because the Intel 8088 for which it was written provides no dual mode and no
hardware protection, the designers of MS-DOS had no choice but to leave the base hardware accessible.
Another example of limited structuring is the original UNIX operating system. Like MS-DOS, UNIX
initially was limited by hardware functionality. It consists of two separable parts: the kernel and the
system programs. The kernel is further separated into a series of interfaces and device drivers. The
traditional unix operating system is shown in the figure 1.7:

Fig 1.7: Traditional UNIX system structure


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.
Layered Approach:
In layered approach, the operating system is broken into a number of layers (levels). The bottom layer
(layer 0) is the hardware; the highest (layer N) is the user interface. This layering structure is depicted in
Figure 1.8.

@Ajay Kumar Badhan Page 15


UNIT – I Introduction to Operating System Concepts

Fig 1.8: A layered operating system


The main advantage of the layered approach is simplicity of construction and debugging. The layers are
selected so that each uses functions (operations) and services of only lower-level layers. This approach
simplifies debugging and system verification. The first layer can be debugged without any concern for
the rest of the system, because, by definition, it uses only the basic hardware (which is assumed correct)
to implement its functions.
Once the first layer is debugged, its correct functioning can be assumed while the second layer is
debugged, and 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 and implementation of the
system are simplified
Each layer is implemented only with operations provided by lower-level layers. A layer does not need to
know how these operations are implemented; it needs to know only what these operations do. Hence,
each layer hides the existence of certain data structures, operations, and hardware from higher-level
layers.

Limitations:
1. The major difficulty with the layered approach involves appropriately defining the various layers.
Because a layer can use only lower-level layers, careful planning is necessary.
2. Another problem with layered implementations is that they tend to be less efficient than other
types. At each layer, the parameters may be modified; data may need to be passes and so on. This
increases the overhead at the system call. The net result will be the system call that takes longer
time than usual.
Micro-kernels:
Mach operating system modularizes the kernel using the microkernel approach. This method structures
the operating system by removing all non essential components from the kernel and implementing them
as system or user level programs. This results in smaller kernel. Micro-kernels provide minimal process
and memory management, in addition to the communication facility. Fig 1.9 represents the architecture
of typical microkernel.

@Ajay Kumar Badhan Page 16


UNIT – I Introduction to Operating System Concepts

The main function of the microkernel is to provide communication between the client program and the
various services that are also running in user space. Communication is provided through message
passing.

Fig 1.9: Architecture of typical microkernel


Benefits of Microkernel:
One benefit of the microkernel approach is that it makes extending the operating system easier. All new
services are added to user space and consequently do not require modification of the kernel. When the
kernel does have to be modified, the changes tend to be fewer, because the microkernel is a smaller
kernel. The resulting operating system is easier to port from one hardware design to another. The
microkernel also provides more security and reliability, since most services are running as use rather
than kernel processes.
Modules:
The best current methodology for operating system design involves using loadable kernel modules.
Here, the kernel has a set of core components and links in additional services via modules, either at boot
time or during run time. This type of design is common in modern implementations of UNIX, such as
Solaris, Linux, and Mac OS X, as well as Windows.
The idea of the design is for the kernel to provide core services while other services are implemented
dynamically, as the kernel is running. The architecture of Solaris system is provided below:

Fig 1.10: Solaris loadable modules


The Solaris operating system structure, shown is organized around a core kernel with seven types of
loadable kernel modules:

@Ajay Kumar Badhan Page 17


UNIT – I Introduction to Operating System Concepts

1. Scheduling classes 5. Streams Modules


2. File Systems 6. Miscellaneous
3. Loadable system calls 7. Device and bus drivers.
4. Executable Formats
Linux also uses loadable kernel modules, primarily for supporting device drivers and file systems.
Hybrid Systems:
A very few operating systems adopt a single, strictly defined structures. Instead they combine different
structures, resulting in hybrid systems that address performances, security and usability issues.
MAC OS X:
The Apple Mac OS X operating system uses a hybrid structures. The structure is shown in the figure
1.11, it’s a layered system.

Fig 1.11: The Mac OS X structure


The top layers include the Aqua user interface and a set of application environments and services.
Notably, the Cocoa environment specifies an API for the Objective-C programming language, which is
used for writing Mac OS X applications. Below these layers is the kernel environment, which consists
primarily of the Mach microkernel and the BSD UNIX kernel. Mach provides memory management;
support for remote procedure calls (RPCs) and inter-process communication (IPC) facilities, including
message passing; and thread scheduling. The BSD component provides a BSD command-line interface,
support for networking and file systems, and an implementation of POSIX APIs, including Pthreads. In
addition to Mach and BSD, the kernel environment provides an I/O kit for development of device
drivers and dynamically loadable modules.
Android:
The Android operating system was designed by the Open Handset Alliance (led primarily by Google)
and was developed for Android smart-phones and tablet computers. Whereas iOS is designed to run on
Apple mobile devices and is close-sourced, Android runs on a variety of mobile platforms and is open-
sourced, partly explaining its rapid rise in popularity. The structure of Android appears in Figure 1.12

@Ajay Kumar Badhan Page 18


UNIT – I Introduction to Operating System Concepts

Fig 1.12: Architecture of Google’s Android

It is a layered stack of software that provides a rich set of frameworks for developing mobile
applications. At the bottom of this software stack is the Linux kernel, although it has been modified by
Google and is currently outside the normal distribution of Linux releases.
The set of libraries available for Android applications includes frameworks for developing web browsers
(webkit), database support (SQLite), and multimedia. The libc library is similar to the standard C library
but is much smaller and has been designed for the slower CPUs that characterize mobile devices.

@Ajay Kumar Badhan Page 19

You might also like