Introduction To Computers Lesson 3
Introduction To Computers Lesson 3
Types of Operating Systems: Some of the widely used operating systems are as follows:
HP 1
OPERATING SYSTEMS
HP 2
OPERATING SYSTEMS
system but on some other system connected within this network i.e., remote access is enabled
within the devices connected in that network.
HP 3
OPERATING SYSTEMS
access of files, printers, security, applications, and other networking functions over a small
private network. One more important aspect of Network Operating Systems is that all the users
are well aware of the underlying configuration, of all other users within the network, their
individual connections etc. and that’s why these computers are popularly known as tightly
coupled systems.
HP 4
OPERATING SYSTEMS
Real-time systems are used when there are time requirements are very strict like missile
systems, air traffic control systems, robots etc.
Two types of Real-Time Operating System which are as follows:
Hard Real-Time Systems:
These OSs are meant for the applications where time constraints are very strict and even
the shortest possible delay is not acceptable. These systems are built for saving life like
automatic parachutes or air bags which are required to be readily available in case of any
accident. Virtual memory is almost never found in these systems.
Soft Real-Time Systems:
These OSs are for applications where for time-constraint is less strict.
Advantages of RTOS:
Maximum Consumption: Maximum utilization of devices and system,thus more output
from all the resources
Task Shifting: Time assigned for shifting tasks in these systems are very less. For example
in older systems it takes about 10 micro seconds in shifting one task to another and in latest
systems it takes 3 micro seconds.
Focus on Application: Focus on running applications and less importance to applications
which are in queue.
Real time operating system in embedded system: Since size of programs are small,
RTOS can also be used in embedded systems like in transport and others.
Error Free: These types of systems are error free.
Memory Allocation: Memory allocation is best managed in these types of systems.
Disadvantages of RTOS:
HP 5
OPERATING SYSTEMS
Limited Tasks: Very few tasks run at the same time and their concentration is very less on
few applications to avoid errors.
Use heavy system resources: Sometimes the system resources are not so good and they
are expensive as well.
Complex Algorithms: The algorithms are very complex and difficult for the designer to
write on.
Device driver and interrupt signals: It needs specific device drivers and interrupt signals
to response earliest to interrupts.
Thread Priority: It is not good to set thread priority as these systems are very less prone to
switching tasks.
Examples of Real-Time Operating Systems are: Scientific experiments, medical imaging
systems, industrial control systems, weapon systems, robots, air traffic control systems, etc.
HP 6
OPERATING SYSTEMS
Job Control
Job control language (JCL) is a scripting language executed on an IBM mainframe
operating system. It consists of control statements that designate a specific job for the
operating system.
Application of JCL:
1. Program control: To control the execution of the command file, we shall require the
usual control structures we find in high-level programming languages – conditional
execution, iteration, composition of instructions, etc.
2. Communication with programs: We require access to the current state of a process, and
to its recent output, and we must be able to set parameters for processes. It is particularly
important to be able to determine why a process stopped.
3. Communication with the system: We must be able to determine normally accessible
facts about the state of the system – are certain files present, what time it is, etc.
HP 7
OPERATING SYSTEMS
A job consists of one or several steps, each of which is a request to run one specific program. For
example, before the days of relational databases, a job to produce a printed report for
management might consist of the following steps:
a user-written program to select the appropriate records and copy them to a temporary
file;
sort the temporary file into the required order, usually using a general-purpose utility;
a user-written program to present the information in a way that is easy for the end-users
to read and includes other useful information such as sub-totals;
and a user-written program to format selected pages of the end-user information for
display on a monitor or terminal.
In both DOS and OS JCL, the first "card" must be the JOB card, which:
Procedures (commonly called procs) are pre-written JCL for steps or groups of steps, inserted
into a job. Both JCLs allow such procedures. Procs are used for repeating steps which are used
several times in one job, or in several different jobs. They save programmer time and reduce the
risk of errors. To run a procedure, one simply includes in the JCL file a single "card" which
copies the procedure from a specified file, and inserts it into the job stream. Also, procs can
include parameters to customize the procedure for each use.
HP 8
OPERATING SYSTEMS
Besides managing complexity, the structure of the operating system can influence key features
such as robustness or efficiency:
The operating system possesses various privileges that allow it to access otherwise
protected resources such as physical devices or application memory. When these
privileges are granted to the individual parts of the operating system that require them,
rather than to the operating system as a whole, the potential for both accidental and
malicious privileges misuse is reduced.
Breaking the operating system into parts can have adverse effect on efficiency because of
the overhead associated with communication between the individual parts. This overhead
can be exacerbated when coupled with hardware mechanisms used to grant privileges.
The following sections outline typical approaches to structuring the operating system.
The monolithic operating system is a very basic operating system in which file management,
memory management, device management, and process management is directly controlled
within the kernel. All these components like file management, memory management etc. are
located within the kernel.
HP 9
OPERATING SYSTEMS
OR
1
HP
0
OPERATING SYSTEMS
Simple structure:
This type of operating system has a simple structure. All the components needed for processing
are embedded into the kernel.
It works better for performing smaller tasks as it can handle limited resources.
All the components can directly communicate with each other and also with the kernel.
VMS
Linux
OS/360
OpenVMS
Multics
1
HP
1
OPERATING SYSTEMS
AIX
BSD
Each layer can interact with the one just above it and the one just below it. Lowermost layer
which directly deals with the bare hardware is mainly meant to perform the functionality of I/O
communication and the uppermost layer which is directly connected with the application
program acts as an interface between user and operating system.
This is highly advantageous structure because all the functionalities are on different layers and
hence each layer can be tested and debugged separately.
1
HP
2
OPERATING SYSTEMS
Micro-Kernel
1
HP
3
OPERATING SYSTEMS
In the above diagram, the microkernel contains basic requirements such as memory, process
scheduling mechanisms and basic inter-process communication. The only software executing at
the privileged level i.e. kernel mode is the microkernel. The other functions of the operating
system are removed from the kernel mode and run in the user mode. These functions may be
device drivers, file servers, application inter-process communication etc.
The microkernel makes sure that the code can be easily managed because the services are
divided in the user space. This means that there is less code running in the kernel mode which
results in increased security and stability.
A microkernel contains only the core functionalities of the system. A component is included in
the microkernel only if putting it outside would disrupt the functionality of the system. All the
other non-essential components are put in the user mode.
1
HP
4
OPERATING SYSTEMS
Memory management mechanisms like address spaces are included in the microkernel.
This also contains memory protection features.
Processor scheduling mechanisms are also necessary in the microkernel. This contains
process and thread schedulers.
Inter-Process Communication (IPC) is important as it is needed to manage the servers
that run their own address spaces.
Providing services in a microkernel system are much more expensive than in a normal
monolithic system. The service is obtained by sending an inter-process communication message
to the server and getting one in return. This means a context switch or a function call if the
drivers are implemented as processes or procedures respectively.
Performance therefore can be complicated in microkernel systems and may lead to some
problems. However, this issue is reducing in the modern microkernel systems created such as L4
microkernel systems.
Benefits of Microkernels
Microkernels are modular and the different modules can be replaced, reloaded, modified,
changed etc. as required. This can be done without even touching the kernel.
Microkernels are quite secure as only those components are included that would disrupt
the functionality of the system otherwise.
Microkernels contain fewer system crashes as compared to monolithic systems. Also, the
crashes that do occur can be handled quite easily due to the modular structure of
microkernels.
1
HP
5
OPERATING SYSTEMS
CHAPTER TWO
PROCESS MANAGEMENT.
PROCESS CONCEPTS.
Definition of terms.
i. PROCESS
A process is a program in execution. The execution of a process must progress in a sequential
fashion.
ii. PROGRAM
A prog ram by itself is not a process. It is a static entity made up of prog ram statement while
process is a dynamic entity. Prog ram contains the instructions to be executed by processor.
A prog ram takes a space at sing le place in main memory and continues to stay there. A prog
ram does not perform any action by itself.
ii. THREAD.
A thread is also called a light weight process. It is a flow of execution through the process code,
with its own prog ram counter, system registers and stack. Threads provide a way to improve
application performance through parallelism. Threads represent a software approach to
improving performance of operating system by reducing the overhead thread is equivalent to a
classical process.
1
HP
6
OPERATING SYSTEMS
Each thread belongs to exactly one process and no thread can exist outside a process. Each
thread represents a separate flow of control. Threads have been successfully used in
implementing network servers and web
server. They also provide a suitable foundation for parallel execution of applications on shared
memory
multiprocessors. Folowing fig ure shows the working of the sing le and multithreaded processes.
PROCESS THREAD
1 Process is heavy weight or resource Thread is light weight taking lesser
intensive resources
than a process.
2 Process switching needs interaction with Thread switching does not need to interact
operating system. with
operating system.
3 In multiple processing environments each All threads can share same set of open files,
process executes the same code but has its child
own memory and file resources processes.
If one process is blocked then no other While one thread is blocked and waiting,
4 process can execute until the first process second
is thread in the same task can run.
unblocked.
5 Multiple processes without using threads Multiple threaded processes use fewer
use resources.
more resources.
6 In multiple processes each process operates One thread can read, write or change
another
thread's data.
1
HP
7
OPERATING SYSTEMS
1
HP
8
OPERATING SYSTEMS
Advantages of Threads
Types of Thread
Threads are implemented in following two ways
User Level Threads -- User managed threads
Kernel Level Threads -- Operating System managed threads acting on kernel, an
operating system core.
1
HP
9
OPERATING SYSTEMS
In this case, thread management is done by the Kernel. There is no thread management
code in the application area. Kernel threads are supported directly by the operating
system. Any application can be programmed to be multithreaded. All of the threads
within an application are supported within a single process. Operating System managed
threads acting on kernel, an operating system core.
The Kernel maintains context information for the process as a whole and for individuals threads
within the process. Scheduling by the Kernel is done on a thread basis. The Kernel performs
thread creation, scheduling and management in Kernel space. Kernel threads are generally
slower to create and manage than the user threads.
2
HP
0
OPERATING SYSTEMS
Advantages
Kernel can simultaneously schedule multiple threads from the same process on multiple
processes.
If one thread in a process is blocked, the Kernel can schedule another thread of the same
process.
Kernel routines themselves can be multithreaded.
Disadvantages
Kernel threads are generally slower to create and manage than the user threads.
Transfer of control from one thread to another within the same process requires a mode
switch to the Kernel.
1 User-level threads are faster to create and manage. Kernel-level threads are slower to
create and manage.
3 User-level thread is generic and can run on any Kernel-level thread is specific to the
operating system. operating system.
2
HP
1
OPERATING SYSTEMS
Each process is represented in the operating system by a process control block (PCB) also called
a task control block. PCB is the data structure used by the operating system. Operating system
groups all information that needs about particular process.
PCB contains many pieces of information associated with a specific process which are described
below.
Process Control Block is a data structure that contains information of the process related to it.
The process control block is also known as a task control block, entry of the process table, etc.
It is very important for process management as the data structuring for processes is done in terms
of the PCB. It also defines the current state of the operating system.
Process control block includes CPU scheduling, I/O resource management, file management
information etc. The PCB serves as the repository for any information which can vary from
process to process. Loader/linker sets flag s and registers when a process is created. If that
process g et suspended, the contents of the registers are saved on a stack and the pointer to the
particular stack frame is stored in the PCB. By this technique, the hardware state can be restored
so that the process can be scheduled to run again.
2
HP
2
OPERATING SYSTEMS
The process control stores many data items that are needed for efficient process management.
Some of these data items are explained with the help of the given diagram
Process State
This specifies the process state i.e. new, ready, running, waiting or terminated.
Process Number
Program Counter
This contains the address of the next instruction that needs to be executed in the process.
Registers
This specifies the registers that are used by the process. They may include accumulators, index
registers, stack pointers, general purpose registers etc.
2
HP
3
OPERATING SYSTEMS
These are the different files that are associated with the process
The process priority, pointers to scheduling queues etc. is the CPU scheduling information that is
contained in the PCB. This may also include any other scheduling parameters.
Memory Management Information
The memory management information includes the page tables or the segment tables depending
on the memory system used. It also contains the value of the base registers, limit registers etc.
This information includes the list of I/O devices used by the process, the list of files etc.
Accounting information
The time limits, account numbers, amount of CPU used, process numbers etc. are all a part of the
PCB accounting information.
The process control block is kept in a memory area that is protected from the normal user access.
This is done because it contains important process information. Some of the operating systems
place the PCB at the beginning of the kernel stack for the process as it is a safe location.
In the Operating System, a Process is something that is currently under execution. So, an
active program can be called a Process. For example, when you want to search something on
web then you start a browser. So, this can be process. Another example of process can be
starting your music player to listen to some cool music of your choice.
2
HP
4
OPERATING SYSTEMS
A Process has various attributes associated with it. Some of the attributes of a Process are:
Process state: Each and every process has some states associated with it at a particular
instant of time. This is denoted by process state. It can be ready, waiting, running, etc.
I/O information: Each process needs some I/O devices for their execution. So, the
information about device allocated and device need is crucial.
States of a Process
During the execution of a process, it undergoes a number of states.
New
This is the state when the process has just been created. It is the initial state in the process life
cycle.
Ready
In the ready state, the process is waiting to be assigned the processor by the short term scheduler,
so it can run. This state is immediately after the new state for the process.
Ready Suspended
The processes in ready suspended state are in secondary memory. They were initially in the
ready state in main memory but lack of memory forced them to be suspended and gets placed in
the secondary memory.
Running
2
HP
5
OPERATING SYSTEMS
The process is said to be in running state when the process instructions are being executed by the
processor. This is done once the process is assigned to the processor using the short-term
scheduler.
Blocked
The process is in blocked state if it is waiting for some event to occur. This event may be I/O as
the I/O events are executed in the main memory and don't require the processor. After the event
is complete, the process again goes to ready state.
Blocked Suspended
This is similar to ready suspended. The processes in blocked suspended state are in secondary
memory. They were initially in the blocked state in main memory waiting for some event but
lack of memory forced them to be suspended and gets placed in the secondary memory. A
process may go from blocked suspended to ready suspended if its work is done.
Terminated
The process is terminated once it finishes its execution. In the terminated state, the process is
removed from main memory and its process control block is also deleted.
2
HP
6
OPERATING SYSTEMS
2
HP
7
OPERATING SYSTEMS
Process Program
A process is program in execution A program is set of instructions
A process is an active/dynamic entity A program is a passive/static entity
A process has a limited life span.It is created
A program has a longer life span. It is stored
when execution starts and terminated as
on disk forever
execution is finished
A process contains various resources like
A program is stored on disk in some file. It
memory address,disk,printer etc as per
does not conatin any other resource
requirement
A process contains memory address which is A program requires memory space on disk to
called address space store all instructions
V. CONCURRENCY CONTROL
2
HP
8