You are on page 1of 13

NAME: ALI AGHA

ENROLLMENT: 02-131222-107
In this assignment your task is to describe, in detail, the process management of:
1. Windows Operating Systems (e.g., various process states, schedulers,
algorithms, etc.)
2. UNIX Operating Systems (e.g., various process states, schedulers, algorithms,
etc.)
Use diagrams, pseudocodes, etc. to support your work.

ANSWER # 01
Windows Operating System Process Management
Controls and coordinates the execution of processes (running programs).Allocates resources,
schedules tasks, and facilitates communication between processes. Examples: Process scheduler,
task manager. Process management in windows refers to the techniques and strategies used by
organizations to design, monitor, and control their processes to achieve their goals efficiently
and effectively. It involves identifying the steps involved in completing a task, assessing the
resources required for each step, and determining the best way to execute the task.
The Windows operating system is responsible for the following activities in connection with
process management:

 Creating and deleting both user and system processes


 Suspending and resuming processes
 Providing mechanisms for process synchronization
 Providing mechanisms for process communication
 Providing mechanisms for deadlock handling
Process States
There are 7 Process States Described below:
1. New State:
A process enters the New state when it is initially created by the operating system.

2. Ready State:
A process moves to the Ready state when it has been created and is awaiting CPU time
for execution. While in the Ready state, the process is waiting for the CPU scheduler to
allocate CPU time. It is prepared for execution, and its context is stored, allowing for a
quick transition to the Running state.
3. Running State:
In the Running state, the process is actively executing instructions on the CPU. It
continues its computations until it voluntarily releases the CPU or gets preempted by the
scheduler.

4. Blocked State:
A process transitions to the Blocked state when it is waiting for an event (e.g., I/O
operation completion, resource availability) that will allow it to proceed.
While in the Blocked state, the process cannot make progress until the specified event
occurs.

5. Exit State (Terminated):


A process enters the Exit state when it completes its execution or is terminated by the
operating system.
In the Exit state, the operating system releases all resources allocated to the process,
updates process accounting information, and ensures a graceful termination. The process
may also return an exit status that can be used by the parent process or the system.

6. Suspend Ready:
The process is temporarily removed from the ready queue.
This state occurs when the operating system decides to suspend the execution of a
process that is in the ready state.
Common reasons for suspension include priority changes, resource constraints, or policy
decisions.

7. Suspend Wait:
The process is temporarily removed from the execution queue while waiting for an event.
This state occurs when a process moves to the blocked state but is further suspended to
free up resources for other processes.
Processes in the suspend state can be resumed when the conditions that led to their
suspension are resolved. Once resumed, they typically move back to their original state
(ready or blocked) in the process lifecycle.

Schedulers
There are 3 Types of shedulers described below:

1. Long-term: Decides how many processes should be made to stay in the ready state. This
decides the degree of multiprogramming. Once a decision is taken it lasts for a long time
which also indicates that it runs infrequently. Hence it is called a long-term scheduler.

2. Short term: Short-term scheduler will decide which process is to be executed next and
then it will call the dispatcher. A dispatcher is a software that moves the process from
ready to run and vice versa. In other words, it is context switching. It runs frequently.
Short-term scheduler is also called CPU scheduler.

3. Medium-term: Suspension decision is taken by the medium-term scheduler. The


medium-term scheduler is used for swapping which is moving the process from main
memory to secondary and vice versa. The swapping is done to reduce degree of
multiprogramming.
Algorithms
There are various algorithms which are used by the Operating System to schedule the processes
on the processor in an efficient way. I Have described 8

1. First Come First Serve:


It is the simplest algorithm to implement. The process with the minimal arrival time will
get the CPU first. The lesser the arrival time, the sooner will the process gets the CPU. It
is the non-preemptive type of scheduling.

2. Round Robin:
In the Round Robin scheduling algorithm, the OS defines a time quantum (slice). All the
processes will get executed in the cyclic way. Each of the process will get the CPU for a
small amount of time (called time quantum) and then get back to the ready queue to wait
for its next turn. It is a preemptive type of scheduling.

3. Shortest Job First:


The job with the shortest burst time will get the CPU first. The lesser the burst time, the
sooner will the process get the CPU. It is the non-preemptive type of scheduling.
4. Shortest remaining time first:
It is the preemptive form of SJF. In this algorithm, the OS schedules the Job according to
the remaining time of the execution.

5. Priority based scheduling:


In this algorithm, the priority will be assigned to each of the processes. The higher the
priority, the sooner will the process get the CPU. If the priority of the two processes is
same then they will be scheduled according to their arrival time.

6. Highest Response Ratio Next:


In this scheduling Algorithm, the process with highest response ratio will be scheduled
next. This reduces starvation in the system.
7. Multilevel Feedback Queue (MLFQ):
This algorithm employs multiple queues with different priorities. Processes are initially
placed in a high-priority queue and are moved to lower-priority queues if they consume
too much CPU time. This helps in handling both interactive and CPU-bound processes
efficiently.

8. Preemptive Scheduling:
Windows supports preemptive scheduling, where a running process can be interrupted
and moved out of the CPU to give way to a higher-priority process. This ensures that
critical tasks are not delayed due to lower-priority activities.
ANSWER # 02
UNIX Operating System Process Management
When you execute a program on your Unix system, the system creates a special environment for
that program. This environment contains everything needed for the system to run the program as
if no other program were running on the system.

Whenever you issue a command in Unix, it creates, or starts, a new process.

Unix supports 2 types of processes


1, System Process:
It runs in kernel mode and executes the operating system functions.
2. Usf Process:
It runs in the background mode

Process states in UNIX


1. User running: The process is executing in user-mode.
2. Kernel Running: The process is executing in the kernel-mode.
3. Ready to run: The process isn’t executing, but it is ready to run as soon as the kernel
schedules it.
4. Asleep: The process is sleeping and resides in the main memory.
5. Ready to run, Swapped: The process is ready to run, but the swapper must swap the process
into the main memory before the kernel can schedule it to execute.
6. Sleeping, Swapped: The process is sleeping, and the swapper has swapped the process to
secondary storage to make room for other processes in the main memory.
7. Preempted: The process is returning from the kernel to user mode but the kernel preempts it
and it does a context switch to schedule another process.
8. Created: The process is newly created and not yet ready to run.
9. Zombie: The process no longer exists, but it leaves a record for its parent process to collect.
Schedulers
1. Long-term scheduler (Admission scheduler): Responsible for selecting processes from
the pool of new processes and loading them into memory for execution. Its goal is to
maintain a good mix of I/O-bound and CPU-bound processes to keep the system
balanced.

2. Short-term scheduler (CPU scheduler): Selects which process to execute next from the
pool of ready processes. Its goal is to maximize CPU utilization, minimize response time,
and ensure fairness among processes. UNIX typically uses preemptive scheduling.

3. Medium-term scheduler (Swapper): Responsible for swapping processes between main


memory and secondary storage (like disk) to manage memory efficiently. It helps to
avoid memory thrashing and ensures that processes with higher priority are given
preference in memory allocation.
Algorithms
1. Round Robin (RR): Each process is assigned a fixed time slice (quantum) for execution.
After the time slice expires, the process is moved to the end of the ready queue, and the
next process is scheduled.

2. Shortest Job Next (SJN) or Shortest Job First (SJF): The process with the shortest
expected processing time is selected next for execution. This algorithm minimizes
average waiting time but may suffer from starvation for longer processes.

3. Priority Scheduling: Each process is assigned a priority. The process with the highest
priority is selected for execution. UNIX systems typically use dynamic priority
adjustments based on factors such as CPU usage, I/O operations, and memory
requirements.

4. Multilevel Feedback Queue (MLFQ): Processes are placed into multiple queues with
different priorities. The scheduler selects processes from the highest priority queue first.
If a process does not finish within its time quantum, it is moved to a lower priority queue,
ensuring that CPU-bound and I/O-bound processes are treated appropriately.
Process Control Block (PCB)

Contains information about a process:


 Process ID (PID)
 Program counter
 CPU registers
 Memory allocation
 State (running, blocked, etc.)

Process Creation and Termination

 fork(): Creates a new process (child) as a copy of the current process (parent).
 exec(): Replaces the current process with a new program.
 exit(): Terminates the process and releases resources.

Real-World Example

 Imagine a web server (e.g., Apache HTTP Server):


 The server process (daemon) listens for incoming requests.
 When a request arrives, it forks a child process to handle it.
 The child process serves the requested content.
 After completion, the child process exits or becomes a zombie.
 The parent process (server) continues listening for new requests.
REFERENCES:

https://www.bing.com/ck/a?!
&&p=69f79746176661ffJmltdHM9MTcxMDQ2MDgwMCZpZ3VpZD0wNzQ1YmI0Yi04ZWZjLTY
5MDAtMjM2Zi1hODg1OGYyNzY4NTEmaW5zaWQ9NTIwNw&ptn=3&ver=2&hsh=3&fclid=0745
bb4b-8efc-6900-236f-
a8858f276851&psq=process+management+in+windows+operating+system&u=a1aHR0cHM6Ly93d3
cuZ2Vla3Nmb3JnZWVrcy5vcmcvaW50cm9kdWN0aW9uLW9mLXByb2Nlc3MtbWFuYWdlbWVu
dC8&ntb=1

https://www.bing.com/ck/a?!
&&p=f0d43b5d13fe5258JmltdHM9MTcxMDQ2MDgwMCZpZ3VpZD0wNzQ1YmI0Yi04ZWZjLTY
5MDAtMjM2Zi1hODg1OGYyNzY4NTEmaW5zaWQ9NTQ3Mg&ptn=3&ver=2&hsh=3&fclid=0745
bb4b-8efc-6900-236f-
a8858f276851&psq=process+states+in+windows+operatomg+system&u=a1aHR0cHM6Ly93d3cuZ2
Vla3Nmb3JnZWVrcy5vcmcvc3RhdGVzLW9mLWEtcHJvY2Vzcy1pbi1vcGVyYXRpbmctc3lzdGVtc
y8&ntb=1

https://www.bing.com/ck/a?!
&&p=da1f4f60cb6bdd12JmltdHM9MTcxMDQ2MDgwMCZpZ3VpZD0wNzQ1YmI0Yi04ZWZjLTY
5MDAtMjM2Zi1hODg1OGYyNzY4NTEmaW5zaWQ9NTIwNA&ptn=3&ver=2&hsh=3&fclid=0745
bb4b-8efc-6900-236f-
a8858f276851&psq=algorithms+in+windows+operating+system&u=a1aHR0cHM6Ly93d3cuZ2Vla3
Nmb3JnZWVrcy5vcmcvY3B1LXNjaGVkdWxpbmctaW4tb3BlcmF0aW5nLXN5c3RlbXMv&ntb=1

https://www.bing.com/ck/a?!
&&p=ba9c2ff49d6a4dc6JmltdHM9MTcxMDQ2MDgwMCZpZ3VpZD0wNzQ1YmI0Yi04ZWZjLTY
5MDAtMjM2Zi1hODg1OGYyNzY4NTEmaW5zaWQ9NTU0Mg&ptn=3&ver=2&hsh=3&fclid=0745
bb4b-8efc-6900-236f-
a8858f276851&psq=UNIX+Operating+System+Process+Management&u=a1aHR0cHM6Ly93ZWJlZ
HVjbGljay5jb20vcHJvY2Vzcy1tYW5hZ2VtZW50LWluLXVuaXgv&ntb=1

You might also like