Unit 2 Processes and Services
Unit 2 Processes and Services
• Error detection
• Program Execution
• Communication
• Input and output operations
• Resource allocation
• File system manipulation
• Protection
The operating system constantly checks for errors, keeps the user updated about
the status, and resolves the error to ensure correct and consistent computing.
Program execution
The operating system must be able to handle program execution. It also provides a
mechanism for process synchronization, communication, and deadlock handling.
I\O operations may be needed by the programs that are currently executing. The OS
provides access to I\O operations(read or write operations of any file) as the user
cannot directly interact with the devices.
The operating system creates an interface for the user to create, delete, and
backup the files. The file system is organized into directories which makes it easier
for the user to navigate through them. The OS is also responsible for programs that
may need permission to access the directories or the files.
• Multiprogramming
• Real-time system
• Distributed environment
• Batch processing
• Interactivity
• Spooling
• Multitasking
Real-time system
The operating system ensures that the response is given in a specified time constraint to
provide accurate performance.
The distributed environment is used when the data has been saved at different locations but
needs to be available locally most of the time, it also reduces the impact of hardware failure or any
specific site.
It can be defined as a set of multiple processors in a single computer system.
Batch processing
The operating system defines a set of jobs that are re-assigned to a command sequence,
programs, and data with a single unit.
In batch processing, the performance is increased as the old job gets completed faster without any
manual interference and the new job is started earlier.
Interactivity means the user’s ability to interact with the computer system.
To help users interact with the system, the OS handles input and output devices and
provides an interface to the user.
Spooling
Spooling stands for Simultaneous Peripheral Operation Online. It is a process in which data
is temporarily held to be used and executed by a device, program, or system.
The OS manages I\O device spooling when it has multiple data access rates.
In multitasking, the CPU executes multiple jobs at the same by switching between the jobs.
The OS handles multiple operations at the same time, this is also known as time-sharing.
Operations on Processes
What is a process?
The user can perform the following operations on a process in the operating system:
• Process creation
• Process scheduling or dispatching
• Blocking
• Preemption
• Termination
Operations on Processes
Process creation
Process creation is the initial step to process execution. It implies the creation
of a new process for execution.
Process scheduling\dispatching
Scheduling or dispatching refers to the event where the OS puts the process
from ready to running state. It is done by the system when there are free
resources or there is a process of higher priority than the ongoing process.
Operations on Processes
Blocking
Block mode is a mode where the system waits for input-output. In process blocking
operation, the system puts the process in the waiting state. When a task is blocked, it is
unable to execute until the task prior to it has finished using the shared resource. Examples
of shared resources are the CPU, network and network interfaces, memory, and disk.
Preemption
Preemption means the ability of the operating system to preempt a currently scheduled task
in favour of a higher priority task. The resource being scheduled can be the processor or the
I\O.
Operations on Processes
Termination
Ending a process is known as process termination. There are many events that may lead to
process termination, some of them are:
Process Scheduling
Process Scheduling Queues
Process scheduling queues are used by the OS to maintain a distinct queue for every PCB
and process state.
Process Scheduling
Two State Process Model
Two state process models are as follows:
Running
Not Running
Running
In the operating system when a new process is created it enters the system in running state.
Not running
The processes that are kept in the queue are in “Not Running” state.
Process Scheduling
Scheduling objectives:
Types of Schedulers
A scheduler is a type of system software that allows us to handle process scheduling.
• Short-term scheduler
• Medium-term scheduler
• Long-term scheduler
Types of Schedulers
Short-term scheduler
Short-term scheduler or CPU scheduler is used to boost the system performance. It decides
which of the ready processes are supposed to be executed.
Medium-term scheduler
Medium-term scheduler temporarily removes processes from the main memory and stores
them in the secondary memory or the other way round. This process is also known as
swapping in or out.
Types of Schedulers
Short-term Scheduler vs Medium-term Scheduler vs Long-term Scheduler
End