0% found this document useful (0 votes)
2 views8 pages

Process Management Reviewer

This document discusses the importance of process management in modern computing, detailing the roles of processes, threads, and the operating system in managing CPU scheduling, synchronization, and deadlock prevention. It explains various CPU scheduling algorithms, including preemptive and non-preemptive methods, and their respective characteristics. Additionally, it includes exam questions to assess understanding of the concepts presented.

Uploaded by

Gerlie Aguinod
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views8 pages

Process Management Reviewer

This document discusses the importance of process management in modern computing, detailing the roles of processes, threads, and the operating system in managing CPU scheduling, synchronization, and deadlock prevention. It explains various CPU scheduling algorithms, including preemptive and non-preemptive methods, and their respective characteristics. Additionally, it includes exam questions to assess understanding of the concepts presented.

Uploaded by

Gerlie Aguinod
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Process Management

In modern computing, efficient process management is crucial for ensuring system stability,
performance, and resource allocation. Process management involves handling the execution of
programs, managing CPU scheduling, synchronizing processes, and preventing deadlocks. The
operating system plays a vital role in overseeing these functions to ensure smooth operation.
This report explores the fundamentals of process management, including processes, threads,
and various scheduling algorithms that optimize system performance.

Process and Threads


What is a program?
- • A program is a set of instructions written in a specific programming language that the
computer can execute.
- • It is essentially a blueprint and does not perform any action until it is run.
What is a process?
• A process is an instance of a program in execution.
•When you run a program, it becomes a process.
•A process has its own memory space, system resources, and an operating system
environment.
What is a thread?
- • A thread is the smallest unit of execution within a process.
- • A process can have multiple threads, all sharing the same memory but running
independently.
- • Threads within a process can perform different tasks simultaneously, improving
efficiency.

THE ROLE OF THE OS:


- Process Creation and Termination
 The OS creates processes when a program starts and removes them when they
finish or crash.

- CPU Scheduling
 The OS ensures efficient execution of multiple processes by managing CPU time in
a multiprogramming system.

- Process Synchronization
 The OS ensures multiple processes work together correctly without data corruption
or race conditions.
- Deadlock Handling
 The OS detects and resolves situations where processes are stuck waiting for each
other indefinitely.

- Inter-Process Communication (IPC)


 The OS allows processes to exchange data using methods like message passing
and shared memory.

CPU Scheduling
- CPU scheduling is a process used by the operating system to decide which task or
process gets to use the CPU at a particular time.
- Maximize the CPU utilization.
- Minimize the response and waiting time of the process.

Terminologies used in CPU Scheduling

 Arrival Time: The time at which the process arrives in the ready queue.
 Completion Time: The time at which the process completes its execution.
 Burst Time: Time required by a process for CPU execution.
 Turn Around Time: Time Difference between completion time and arrival time.
Turn Around Time = Completion Time – Arrival Time
 Waiting Time(W.T): Time Difference between turn around time and burst time.
Waiting Time = Turn Around Time – Burst Time

Different types of CPU Scheduling Algorithm

 Preemptive Scheduling:

- Preemptive scheduling is used when a process switches from running state to ready
state or from the waiting state to the ready state.

 Non-Preemptive Scheduling:
- Non-Preemptive scheduling is used when a process terminates , or when a process
switches from running state to waiting state.
CPU Scheduling Algorithms
 FCFS – First Come, First Serve
 SJF – Shortest Job First
 SRTF – Shortest Remaining Time First
 Round Robin
 Priority Scheduling
 HRRN – Highest Response Ratio Next
 Multiple Queue Scheduling
 Multilevel Feedback Queue Scheduling

Operating System Scheduling Algorithms


 First-Come, First-Served (FCFS) Scheduling
- Jobs are executed on first come, first serve basis.
- It is a non-preemptive, pre-emptive scheduling algorithm.
- Easy to understand and implement. Its implementation is based on FIFO queue.
- Poor in performance as average wait time is high.

 Shortest-Job-Next (SJN) Scheduling


- This is also known as shortest job first, or SJF This is a non-preemptive, pre-emptive
scheduling algorithm.
- Best approach to minimize waiting time.
- Easy to implement in Batch systems where required CPU time is known in advance.
- Impossible to implement in interactive systems where required CPU time is not known.
- The processer should know in advance how much time process will take.

 Priority Scheduling
- Priority scheduling is a non-preemptive algorithm and one of the most common
scheduling algorithms in batch systems.
- Each process is assigned a priority. Process with highest priority is to be executed first
and so on.
- Processes with same priority are executed on first come first served basis.
- Priority can be decided based on memory requirements, time requirements or any other
resource requirement.

 Shortest Remaining Time


- Shortest remaining time (SRT) is the preemptive version of the SJN algorithm.
- The processor is allocated to the job closest to completion but it can be preempted by a
newer ready job with shorter time to completion.
- Impossible to implement in interactive systems where required CPU time is not known.
- It is often used in batch environments where short jobs need to give preference.

 Round Robin(RR) Scheduling


- Round Robin is the preemptive process scheduling algorithm.
- Each process is provided a fix time to execute, it is called a quantum.
- Once a process is executed for a given time period, it is preempted and other process
executes for a given time period.
- Context switching is used to save states of preempted processes.

 Multiple-Level Queues Scheduling


- Multiple-level queues are not an independent scheduling algorithm. They make use of
other existing algorithms to group and schedule jobs with common characteristics.
- Multiple queues are maintained for processes with common characteristics. Each queue
can have its own scheduling algorithms. Priorities are assigned to each queue.

Process Management Exam

Section A: Multiple Choice Questions (MCQs) (Each question carries 2 marks)

1. What is the main role of process management in an operating system?

a) Managing hardware devices

b) Ensuring system stability, performance, and resource allocation

c) Controlling the internet connection

d) Formatting hard drives

2. Which of the following best describes a process?

a) A static set of instructions written in a programming language

b) A program in execution

c) A thread of execution within a program

d) A function inside a program

3. What is a thread in process management?

a) A separate program running in the OS

b) The smallest unit of execution within a process

c) A hardware component
d) A type of CPU scheduling algorithm

4. What is the main function of CPU scheduling?

a) Assigning tasks to RAM

b) Deciding which process gets to use the CPU at a particular time

c) Managing hardware drivers

d) Formatting storage devices

5. Which of the following scheduling algorithms follows the First-Come, First-Served


principle?

a) SJF

b) FCFS

c) Round Robin

d) Priority Scheduling

6. What is Inter-Process Communication (IPC)?

a) A method of CPU scheduling

b) A technique for memory management

c) A method for processes to exchange data

d) A deadlock prevention technique

7. In Round Robin scheduling, what is a time quantum?

a) The priority level assigned to a process

b) The amount of CPU time allocated to each process before switching

c) The total execution time of a process


d) The idle time of the CPU

8. Which scheduling algorithm gives the CPU to the process with the shortest execution time?
a) FCFS

b) SJF

c) Priority Scheduling

d) Round Robin

Section B: True or False (Each question carries 1 mark)

9. The operating system is responsible for process creation and termination. (True)
10. Round Robin scheduling is a non-preemptive scheduling algorithm. (False)
11. Preemptive scheduling allows a process to be interrupted and moved to a ready state.
(True)
12. SJF scheduling always ensures the lowest average waiting time. (False, only in ideal
cases)
13. In priority scheduling, processes with the lowest priority execute first. (False)
14. Deadlock occurs when processes wait indefinitely for resources held by others. (True)
15. IPC methods include message passing and shared memory. (True)

Section C: Short Answer Questions (Each question carries 5 marks)

16. Define the following terms: a) Arrival Time


b) Burst Time
c) Turnaround Time
d) Waiting Time
Answer:

 Arrival Time: The time at which a process arrives in the ready queue.
 Burst Time: The time required by a process for CPU execution.
 Turnaround Time: The difference between completion time and arrival time. Formula:
Turnaround Time = Completion Time – Arrival Time.
 Waiting Time: The difference between turnaround time and burst time. Formula:
Waiting Time = Turnaround Time – Burst Time.

17. Explain the difference between preemptive and non-preemptive scheduling. Answer:

 Preemptive Scheduling: Allows the operating system to interrupt a running process and
move it back to the ready state to allocate CPU time to another process.
 Non-Preemptive Scheduling: Once a process starts execution, it runs until it either
completes or moves to a waiting state. The CPU is not taken away until the process is
finished.

Section D: Problem-Solving (Each question carries 10 marks)

18. Given the following processes with arrival time and burst time, calculate Turnaround
Time (TAT) and Waiting Time (WT) using the FCFS scheduling algorithm.

Process Arrival Time Burst Time


P1 0 5
P2 1 3
P3 2 8
P4 3 6

Solution:

 Completion Time (CT) Calculation:


o P1: 0 + 5 = 5
o P2: 5 + 3 = 8
o P3: 8 + 8 = 16
o P4: 16 + 6 = 22
 Turnaround Time (TAT) = Completion Time - Arrival Time
o P1: 5 - 0 = 5
o P2: 8 - 1 = 7
o P3: 16 - 2 = 14
o P4: 22 - 3 = 19
 Waiting Time (WT) = Turnaround Time - Burst Time
o P1: 5 - 5 = 0
o P2: 7 - 3 = 4
o P3: 14 - 8 = 6
o P4: 19 - 6 = 13

Final Answer:

 TAT: P1=5, P2=7, P3=14, P4=19


 WT: P1=0, P2=4, P3=6, P4=13

Section E: Essay Question (Each question carries 10 marks)

19. Discuss the importance of process synchronization and deadlock handling in modern
operating systems. Answer:

 Process Synchronization:
o Ensures multiple processes work together without conflicts.
o Prevents data inconsistency caused by race conditions.
o Used in multi-threaded applications for efficient execution.
 Deadlock Handling:
o Occurs when two or more processes wait indefinitely for resources held by each
other.
o The OS detects and resolves deadlocks using techniques like resource allocation
graphs and prevention strategies.
o Proper handling improves system efficiency and stability.

You might also like