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

MODULE 1 ECT426: REAL TIME OPERATING SYSTEM

Syllabus : Operating system: Types, Objectives and functions , Kernel, Process - States,
Process Control Block, Operations on processes.

This chapter covers the introduction to operating system, Types, Objective and functions,
Kernel - Importance and functions and Process - States, Process Control Block, Operations on
processes.

INTRODUCTION TO OPERATING SYSTEMS

An operating system is a program that manages the computer hardware. It also provides a basis
for application programs and acts as an intermediary between the computer user and the
computer hardware.

OBJECTIVES OF OPERATING SYSTEMS


1. Convenience: OS makes a computer more convenient to use.
2. Efficiency: OS allows the computer system resources to be used in an efficient manner.
3. Ability to evolve: OS should be constructed in such a way as to permit the effective
development, testing, and introduction of new system functions without interfering with
service.
FEATURES OF OPERATING SYSTEMS
1. Provides a platform for running applications
2. Handles memory management and CPU scheduling
3. Provides file system abstraction
4. Provides networking support
5. Provides security features
6. Provides user interface

1
SNMIMT,Maliankara
MODULE 1 ECT426: REAL TIME OPERATING SYSTEM

7. Provides utilities and system services


8. Supports application development
TYPES OF OPERATING SYSTEM
There are several different types of operating systems present. In this section, we will discuss
the advantages and disadvantages of these types of OS.
1. Batch OS
2. Distributed OS
3. Multitasking OS
4. Network OS
5. Real-OS
6. Mobile OS
BATCH OS
Batch OS is the first operating system for second-generation computers. This OS does not
directly interact with the computer. Instead, an operator takes up similar jobs and groups them
together into a batch, and then these batches are executed one by one based on the first-come,
first, serve principle.
Examples: Payroll System, Bank Invoice System, Transactions Process, Daily Report,
Research Segment, Billing System
Advantages of Batch OS
• Execution time taken for similar jobs is higher.
• Multiple users can share batch systems.
• Managing large works becomes easy in batch systems.
• The idle time for a single batch is very less.
Disadvantages of OS
• It is hard to debug batch systems.
• If a job fails, then the other jobs must wait for an unknown time till the issue is resolved.
• Batch systems are sometimes costly.
DISTRIBUTED OS
A distributed OS is a recent advancement in the field of computer technology and is utilized
all over the world that too with great pace. In a distributed OS, various computers are connected
through a single communication channel. These independent computers have their memory
unit and CPU and are known as loosely coupled systems. The system processes can be of
different sizes and can perform different functions. The major benefit of such a type of
operating system is that a user can access files that are not present on his system but in another

2
SNMIMT,Maliankara
MODULE 1 ECT426: REAL TIME OPERATING SYSTEM

connected system. In addition, remote access is available to the systems connected to this
network.
Examples : Solaris, OSF/1, Micros, DYNIX, Locus, Mach
Advantages of Distributed OS
• Failure of one system will not affect the other systems because all the computers are
independent of each other.
• The load on the host system is reduced.
• The size of the network is easily scalable as many computers can be added to the
network.
• As the workload and resources are shared therefore the calculations are performed at a
higher speed.
• Data exchange speed is increased with the help of electronic mail.
Disadvantages of Distributed OS
• The setup cost is high.
• Software used for such systems is highly complex.
• Failure of the main network will lead to the failure of the whole system.
• Examples of Distributed OS: LOCUS, etc.
Multitasking OS
The multitasking OS is also known as the time-sharing operating system as each task is given
some time so that all the tasks work efficiently. This system provides access to a large number
of users, and each user gets the time of CPU as they get in a single system. The tasks performed
are given by a single user or by different users. The time allotted to execute one task is called
a quantum, and as soon as the time to execute one task is completed, the system switches over
to another task.
Advantages of Multitasking OS
• Each task gets equal time for execution.
• The idle time for the CPU will be the lowest.
• There are very few chances for the duplication of the software.
Disadvantages of Multitasking OS
• Processes with higher priority cannot be executed first as equal priority is given to each
process or task.
• Various user data is needed to be taken care of from unauthorized access.
• Sometimes there is a data communication problem.
• Examples of Multitasking OS: UNIX, etc.

3
SNMIMT,Maliankara
MODULE 1 ECT426: REAL TIME OPERATING SYSTEM

Network OS
Network operating systems are the systems that run on a server and manage all the networking
functions. They allow sharing of various files, applications, printers, security, and other
networking functions over a small network of computers like LAN or any other private
network. In the network OS, all the users are aware of the configurations of every other user
within the network, which is why network operating systems are also known as tightly coupled
systems.
Advantages of Network OS
• New technologies and hardware can easily upgrade the systems.
• Security of the system is managed over servers.
• Servers can be accessed remotely from different locations and systems.
• The centralized servers are stable.
Disadvantages of Network OS
• Server costs are high.
• Regular updates and maintenance are required.
• Users are dependent on the central location for the maximum number of operations.
• Examples of Network OS: Microsoft Windows server 2008, LINUX, etc.
REAL-TIME OS
Real-Time operating systems serve real-time systems. These operating systems are useful when
many events occur in a short time or within certain deadlines, such as real-time simulations.
Types of the real-time OS are:
Hard real-time OS
The hard real-time OS is the operating system for mainly the applications in which the slightest
delay is also unacceptable. The time constraints of such applications are very strict. Such
systems are built for life-saving equipment like parachutes and airbags, which immediately
need to be in action if an accident happens.
Soft real-time OS
The soft real-time OS is the operating system for applications where time constraint is not very
strict. In a soft real-time system, an important task is prioritized over less important tasks, and
this priority remains active until the completion of the task. Furthermore, a time limit is always
set for a specific job, enabling short time delays for future tasks, which is acceptable. For
Example, virtual reality, reservation systems, etc.

4
SNMIMT,Maliankara
MODULE 1 ECT426: REAL TIME OPERATING SYSTEM

Advantages of Real-Time OS
• It provides more output from all the resources as there is maximum utilization of
systems.
• It provides the best management of memory allocation.
• These systems are always error-free.
• These operating systems focus more on running applications than those in the queue.
• Shifting from one task to another takes very little time.
Disadvantages of Real-Time OS
• System resources are extremely expensive and are not so good.
• The algorithms used are very complex.
• Only limited tasks can run at a single time.
• In such systems, we cannot set thread priority as these systems cannot switch tasks
easily.
Mobile OS
A mobile OS is an operating system for smartphones, tablets, and PDA’s. It is a platform on
which other applications can run on mobile devices.
Examples of Mobile OS: Android OS, ios, Symbian OS, and Windows mobile OS.
OPERATING SYSTEMS SERVICES AND FUNCTIONS
User interface: Almost all operating systems have a user interface (UI). One is a command-
line interface (eLI), which uses text commands and a method for entering them. 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.
Program execution : The system must be able to load a program into memory and to run that
program. The program must be able to end its execution, either normally or abnormally.
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 CRT 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.
File-system manipulation: The 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.
Some programs include permissions management to allow or deny access to files or directories
based on file ownership.

5
SNMIMT,Maliankara
MODULE 1 ECT426: REAL TIME OPERATING SYSTEM

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 or through message passing, in which packets of information are moved between
processes by the operating system.
Error detection: The operating system needs to be constantly aware of possible errors. 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 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, 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. Debugging
facilities can greatly enhance the user's and programmer's abilities to use the system efficiently.
Resource allocation: When there are multiple users or multiple jobs running at the same time,
resources must be allocated to each of them. Many different types of resources are managed by
the operating system. Some resources 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 consider 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, modems, USB storage drives, and other peripheral devices.
Accounting: We want 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. Usage statistics may be a valuable tool for researchers who
wish to reconfigure the system to improve computing services.
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
password, to gain access to system resources. It extends to defending external I/O devices,
including modems and network adapters, from invalid access attempts and to recording all such
connections for detection of break-ins. If a system is to be protected and secure, precautions
must be instituted throughout it.

6
SNMIMT,Maliankara
MODULE 1 ECT426: REAL TIME OPERATING SYSTEM

KERNEL

Kernel is central component of an operating system that manages operations of computer and
hardware. It basically manages operations of memory and CPU time. It is core component of
an operating system. Kernel acts as a bridge between applications and data processing
performed at hardware level using inter-process communication and system calls.

Kernel loads first into memory when an operating system is loaded and remains into
memory until operating system is shut down again. It is responsible for various tasks such as
disk management, task management, and memory management. Kernel has a process table that
keeps track of all active processes.

Kernel loads an executable file into memory during ‘exec’ system call’. It decides
which process should be allocated to processor to execute and which process should be kept in
main memory to execute. It basically acts as an interface between user applications and
hardware. The major aim of kernel is to manage communication between software i.e. user-
level applications and hardware i.e., CPU and disk memory.

Objectives of Kernel:

• To establish communication between user level application and hardware.


• To decide state of incoming processes.
• To control disk management.
• To control memory management.
• To control task management.

TYPES OF KERNEL

1. Monolithic Kernel: It is one of types of kernel where all operating system services operate
in kernel space. It has dependencies between systems components. It has huge lines of code
which is complex.

Example: Unix, Linux, Open VMS, XTS-400 etc.

2. Micro Kernel: It is kernel types which has minimalist approach. It has virtual memory and
thread scheduling. It is more stable with less services in kernel space. It puts rest in user space.

Example : Mach, L4, AmigaOS, Minix, K42 etc.

3. Hybrid Kernel: It is the combination of both monolithic kernel and microkernel. It has
speed and design of monolithic kernel and modularity and stability of microkernel.

7
SNMIMT,Maliankara
MODULE 1 ECT426: REAL TIME OPERATING SYSTEM

Example: Windows NT, Netware, BeOS etc.

4. Exo Kernel: It is the type of kernel which follows end-to-end principle. It has fewest
hardware abstractions as possible. It allocates physical resources to applications.

Example : Nemesis, ExOS etc.

5. Nano Kernel: It is the type of kernel that offers hardware abstraction but without system
services. Micro Kernel also does not have system services therefore the Micro Kernel and Nano
Kernel have become analogous.

Example: EROS etc.

DIFFERENCE BETWEEN OPERATING SYSTEM AND KERNAL

Operating System Kernel

1. Kernel is system software which is part of


1. Operating System is a system software. operating system.

2. Operating System provides interface 2. Kernel provides interface between


between user and hardware. applications and hardware.
3. It’s main purpose is memory
3. It also provides protection and security. management, disk management, process
management and task management.

4. All system needs operating system to run. 4. All operating systems need kernel to run.

5. Type of operating system includes single 5. Type of kernel includes Monolithic and
and multiuser OS, multiprocessor OS, Micro kernel.
Realtime OS, Distributed OS.
6. It is the first program to load when 6. It is the first program to load when
computer boots up. operating system loads.

8
SNMIMT,Maliankara
MODULE 1 ECT426: REAL TIME OPERATING SYSTEM

PROCESSES

a process is a program in execution. A process is more than the


program code, which is sometimes known as the text section. It also
includes the current activity, as represented by the value of the
program counter and the contents of the processor's registers. A
process generally also includes the process stack, which contains
temporary data (such as function parameters, return addresses, and
local variables), and a data section, which contains global variables.
A process may also include a heap, which is memory that is
dynamically allocated during process run time. The structure of a
process in memory is shown in the figure.

Independent processes and Cooperating processes

Processes executing concurrently in the operating system may be either independent processes
or cooperating processes. A process is independent if it cannot affect or be affected by the other
processes executing in the system. Any process that does not share data with any other process
is independent. Any process that shares data with other processes is a cooperating process.
There are several reasons for providing an environment that allows process cooperation:

➢ Information sharing: Since several users may be interested in the same piece of
information (for instance, a shared file), we must provide an environment to allow
concurrent access to such information.
➢ Computation speedup: If we want a particular task to run faster, we must break it into
subtasks, each of which will be executing in parallel with the others. Notice that such a
speedup can be achieved only if the computer has multiple processing elements.
➢ Modularity: We may want to construct the system in a modular fashion, dividing the
system functions into separate processes or threads.
➢ Convenience: Even an individual user may work on many tasks at the same time. For
instance, a user may be editing, printing, and compiling in parallel.

Cooperating processes require an Inter Process Communication (IPC) mechanism that will
allow them to exchange data and information. There are two fundamental models of inter
process communication:

1. Shared memory.
2. Message passing.

9
SNMIMT,Maliankara
MODULE 1 ECT426: REAL TIME OPERATING SYSTEM

In the shared-memory model, a region of memory that is shared by cooperating processes is


established. Processes can then exchange information by reading and writing data to the shared
region. In the message passing model, communication takes place by means of messages
exchanged between the cooperating processes.

PROCESS STATE

As a process executes, it changes state. The state of a process is defined in part by the current
activity of that process. Each process may be in one of the following states:

1. New: The process is being created.


2. Running: Instructions are being executed.
3. Waiting: The process is waiting for some event to occur
4. Ready: The process is waiting to be assigned to a processor.
5. Terminated: The process has finished execution.

It is important to realize that only one process can be running on any processor at any instant.

Many processes may be ready and waiting, however. The state diagram corresponding to these
states is presented in figure.

PROCESS CONTROL BLOCK

Each process is represented in the operating system by a process


control block (PCB)-also called a task control block. A PCB is
shown in Figure. It contains many pieces of information associated
with a specific process.

• Process state: The state may be new, ready, running, waiting,


halted, and so on.

• Program counter: The counter indicates the address of the next


instruction to be executed for this process.

10
SNMIMT,Maliankara
MODULE 1 ECT426: REAL TIME OPERATING SYSTEM

• CPU registers: The registers vary in number and type, depending on the computer
architecture. They include accumulators, index registers, stack pointers, and general-purpose
registers, plus any condition-code information. Along with the program counter, this state
information must be saved when an interrupt occurs, to allow the process to be continued
correctly afterward

• CPU-scheduling information: This information includes a process priority, pointers to


scheduling queues, and any other scheduling parameters.

• Memory-management information:
This information may include such
information as the value of the base and
limit registers, the page tables, or the
segment tables, depending on the memory
system used by the operating system.

• Accounting information: This


information includes the amount of CPU
and real time used, time limits, account
numbers, job or process numbers, and so
on.

• I/O status information: This information includes the list of I/O devices allocated to the
process, a list of open files, and so on.

OPERATIONS ON PROCESSES
The processes in most systems can execute concurrently, and they may be created and deleted
dynamically. Thus, these systems must provide a mechanism for process creation and
termination.

A) Process Creation: A process may create several new processes, via a create-process system
call during the course of execution. The creating process is called a parent process, and the new
processes are called the children of that process. Each of these new processes may in turn create
other processes, forming a tree of processes. In general, a process will need certain resources
(CPU time, memory, files, 1/0 devices) to accomplish its task. When a process creates a
subprocess, that subprocess may be able to obtain its resources directly from the operating
system, or it may be constrained to a subset of the resources of the parent process. The parent

11
SNMIMT,Maliankara
MODULE 1 ECT426: REAL TIME OPERATING SYSTEM

may have to partition its resources among its children, or it may be able to share some resources
(such as memory or files) among several of its children.

When a process creates a new process, two possibilities exist in terms of execution:

1. The parent continues to execute concurrently with its children.


2. The parent waits until some or all of its children have terminated.

There are also two possibilities in terms of the address space of the new process:

1. The child process is a duplicate of the parent process (it has the same program and data
as the parent).
2. The child process has a new program loaded into it.

The figure illustrates in the parent waits for the child process to complete with the wait ()
system call. When the child process completes by either implicitly or explicitly invoking
exit()the parent process resumes from the call to wait () , where it completes using the exit ()
system call.

B) Process Termination

A process terminates when it finishes executing its final statement and asks the operating
system to delete it by using the exit () system call. At that point, the process may return a status
value, typically an integer, to its parent process via the wait() system call. All the resources of
the process-including physical and virtual memory, open files, and I/O buffers-are deallocated
by the operating system.

A parent may terminate the execution of one of its children for a variety of reasons, such as
these:

➢ The child has exceeded its usage of some of the resources that it has been allocated.
➢ The task assigned to the child is no longer required.

12
SNMIMT,Maliankara
MODULE 1 ECT426: REAL TIME OPERATING SYSTEM

➢ The parent is exiting, and the operating system does not allow a child to continue if
its parent terminates.

cascading termination

Some systems, do not allow a child to exist if its parent has terminated. In such systems, if a
process terminates, then all its children must also be terminated. This phenomenon, referred to
as cascading termination, is normally initiated by the operating system.

************************

13
SNMIMT,Maliankara

You might also like