Processes & Services: Complete Guide for Beginners
Processes &
services In Operating system – Each & everything you
should know
We are often listen about
process and service, but don’t know what the concept is, so let’s learn it
deeply basically these concept are very important that how computer actually
works inside.
In this blog, we will learn
about processes and services in easy or understanding English,
so that even a beginner can understand them easily.
You must have the basic knowledge about operating systems and programs before learning this topic.
What is a program?
So first of all we are going to talk about program. A
program is a set of instruction given to the computer to perform a specific
task, program is stored on Hard disk or SSD.
For example user
have a chrome browser in pc, Ms Word installed on user’s pc and a calculator in
user’s pc, these are all program but they are basically inactive , until user
open or run them.
A program doesn’t doing anything by itself until user use
a program.
Processes
A process is a running
instance of a program. Means a program which start loading into RAM and starts
running with the help of the CPU, it becomes a process. Processes are exist
only while program is running but when then the program ends and back to
inactive state, the process also ends.
A program is inactive when it saved on hard disk (chrome saved on hard disk).It become process when it is active and start using CPU, RAM and other resources.
Process (PID)
Operating system give a
unique number to every process Which is called process ID (PID).you can say
every process have its unique identity card, with the help of PID operating
system can manage multiple processes at the same time.
·
This number helps the
operating system to identify each process easily.
·
The operating system
can allocate CPU time to process using PID.
·
It also manage memory
or each process using PID number.
·
OS track the current
state of a process.
· Also terminate a process when required.
Process states
Every process has different
stages. It doesn’t continuously run, even passes from different stages during
its life cycle.
New state
In
this state, the process is created, when the user click on chrome icon, then
the operating system starts processing chrome, allocate the memory and assign a
PID to the process, in this moment it is called the new state of process.
Ready state
In this state, the process
is ready to run but waiting for CPU, because only one process can use CPU at a
time, therefore others should to be waiting for CPU.
Running state
In this state, the process
is actively executed by the CPU. When the CPU gives instructions to the
application, means the application is in running state.
Waiting/blocked state
In this state, the process
is temporarily stopped or blocked due to some response or waiting for a web
page to load from the internet like user input, file loading, internet response
late, hardware operations and etc.
Terminated state
In this state, when the user complete it work and close chrome, then the process will ends and move to the terminated state, process getting remove from memory , the process finish execution and operating system release all the resources.
Key points of Process
Its enable multitasking means allow more than one process
to run at the same time.
A user open a YouTube, listen a music, or type any kind
of document at a same time.
It helps operating system to manage CPU schedule, to
allocate memory and handle input/output operations.
Its Improve system efficiency and user experience.
Service
A service is also a process
but it is a special type of process which runs in the background and runs
silently, background processes are critical for system stability and performance,
service cannot open manually but system depends on service, it’s continuously
running for system.
It perform the system-level
processes, it starts with the system boots and running without any user
interaction and continue running for a long time.
In windows service process called services and in Linux/Unix it’s called daemons.
Some types of service
process
Window
update service
It automatically downloads and install system updates.
Print
spooler service
When you print something it automatically manage printing
tasks and sends documents to the printer.
Network
service
It’s responsible for maintain internet and network
connectivity.
Security
service
It also protect system from virus’s attacks and malware as background task without user interference.
Differentiate Between Process & Service
Possible Interview Questions to Remember
Define process in operating system?
Answer:
A process is a program which is currently running in the computer’s
memory (RAM). It becomes a process when the user chick on any application on
system it become process.
Differentiate
between program & process?
Answer:
Program
·
Passive state
·
Not running
·
Does not use CPU
Process
·
Active state
·
Running on CPU
·
Uses CPU, memory, and I/O devices
Elaborate different states of process?
Answer:
·
New state
·
Ready state
·
Running state
·
Waiting / Blocked state
·
Terminated state
Elaborate Process ID (PID)?
Answer:
A Process ID is like e identity card or a
unique number assigned to every process by the operating system.
It is important for the OS to:
·
Identify and
manage process
·
Allocate CPU
and RAM
·
Terminate /
blocked processes
What is a role of service in an operating system?
Answer:
A service is also a process
but it is a special type of process which runs in the background and runs
silently to process computer operations.
Differentiate between a process and a service?
Answer:
Process
·
Usually started by user
·
User can interact
·
Mostly visible
·
Performs user tasks
Service
·
Usually starts automatically
·
No direct user interaction
·
Runs in background
·
Supports system functions
Service is also a process or not?
Answer:
Yes, every service is a process, Services basically designed for
system-level background tasks, whereas normal processes are for user-level
tasks.
Give practical examples of a process and a service.
Answer:
Process: user open
MS word and start typing it’s a process.
Service: Windows
Update running in background is called service.
Importance of process in operating system?
Answer:
Processes
are important because its:
·
Enable
multitasking
·
Efficiently
use of CPU and RAM
·
Ensure the
proper working of operating system
·
Improve
system performance
Define Daemons in Linux?
Answer:
Daemons are the
Linux services. They are background processes that provide system-level
functions.
Define how a process moves between states.
Answer:
User open chrome in system:
New: user click
chrome icon , OS creates
process
Ready: Waiting for
CPU
Running: User start
browsing , CPU
executes instructions
Waiting: chrome wait
for the internet
Terminated: user close
chrome , process
ends
How the OS schedule processes?
Answer:
Operating System
uses CPU scheduling algorithms
to manage process.
·
First-Come-First-Serve
·
Shortest Job
Next
·
Round Robin
·
Priority
Scheduling
Explain some common errors with processes and
services?
Answer:
·
Deadlock: when Two or more processes waiting indefinitely
for each other to release resources.
·
Starvation: Low-priority process never gets CPU time.
·
Resource
Leak: Process or
service holds memory or file handles after termination.
·
Zombie
Processes: Finished
processes not cleaned by parent.
·
Is a service different from a daemon?
Answer:
Both run in
the background but in different operating systems.
·
Service: Windows
·
Daemon: Linux/Unix
Functionally,
both provide system-level tasks without user interaction.
YOU MAY ALSO LIKE TO LEARN ABOUT
Conclusion
In conclusion, processes
and services are most important part of an operating system.
Where a process include program that is currently running using RAM or CPU with
the interaction of user. While the service include process that continues runs
background and perform system level function without user interaction.
Both work together to
maintain system efficient and smooth performance also making the operating
system reliable and user-friendly.
Comments
Post a Comment