Code360 powered by Coding Ninjas X Code360 powered by Coding Ninjas X
Table of contents
Last Updated: Mar 27, 2024

Process management

Leveraging ChatGPT - GenAI as a Microsoft Data Expert
Prerita Agarwal
Data Specialist @
23 Jul, 2024 @ 01:30 PM


The process is any program in execution. Each process requires some resources during its execution. There may exist more than one process in the system that can ask for the same resources simultaneously. So, it is the task of the operating system to manage all the processes and resources conveniently and efficiently. This is called Process management. 

Go to this link to learn more about Process management.

Now, we will see gate questions on Process Management in Operating systems with their solutions and explanations.


1. A process current activity is represented by

    1. Program counter

    2. Contents of process's register

    3. Stack 

    4. Data Section

  1. 1
  2. 1,2
  3. 1,2,3
  4. 1,2,3,4

Ans  b

2. A process generally includes ______, _________ and ___________ which contains temporary data(such as function parameters, return address, and local variables), global variables, and a memory which is dynamically allocated at the run time respectively.

  1. Heap, Stack, Data section
  2. Data Section, Heap, Stack
  3. Stack, Heap, Data Section
  4. Stack, Data Section, Heap

Ans d

3. Switching the CPU to another process requires performing a state save of the current process and a state restore of a different process. This is called ______

  1. Swapping
  2. Context switching
  3. Demand Paging 
  4. Page Fault

Ans: b

4. If the time slice used in the round-robin scheduling policy is more than the maximum time required to execute any process, then the policy will

  1. degenerate to the shortest job first
  2. degenerate to priority scheduling
  3. degenerate to first come, first serve
  4. none of the above

Ans: c  

Explanation: RR executes processes in an FCFS manner with a time slice. At this time slice becomes long enough so that a process finishes within it. It becomes FCFS.

5. Which of the following actions is typically not performed by the operating system when switching context from process A to process B?

  1. Saving current register values and restoring saved register values for process B.
  2. Changing address translation tables.
  3. Swapping out the memory image of process A to the disk.
  4. Invalidating the translation look-aside buffer.

Ans: c

Explanation: During a context switch, processes are not swapped out from memory to disk, but processes are generally swapped out from memory to disk when they are suspended. Also, during context switch, OS invalidates TLB so that the TLB coincides with the currently executing processes.

So, option (c) is false.

6. Which of the following need not necessarily be saved on a context switch between processes?

  1. General-purpose registers
  2. Translation look-aside buffer
  3. Program counter
  4. All of the above

Ans: b

Explanation: The values stored in stack pointers,  registers and program counters are saved on context switch between the processes to resume the execution of the process.

There’s no need to save the contents of TLB as it is invalidated after each context switch.

So, option (b) is correct.

7. Consider the following code fragment:

if (fork() == 0)

{ a = a + 5; printf("%d,%dn", a, &a); }

else { a = a –5; printf("%d, %dn", a, &a); }

Let v, u be the values printed by the parent process, and x, y be the values printed by the child process. Which one of the following is TRUE?

  1. u = x + 10 and v = y
  2. u = x + 10 and v != y
  3. u + 10 = x  and v = y
  4. u + 10 = x  and v != y

Ans: c 

Explanation: fork() returns 0 in the child process and process ID of child process in the parent process. In Parent (u), a = a – 5 and In Child (x), a = a + 5; Hence x = u + 10. The physical addresses of 'a' in child and parent should be different. But our program has virtual addresses as we are operating on an OS that utilizes virtual memory. The child process gets a copy of the parent process, and the virtual address of 'a' doesn't change in the child process. Therefore, we get the same addresses in both parent and child. 

8. The following C program is executed on a  Linux/Unix system:

#include <unistd.h>

  int main() {

    int j;

    for (j = 0; j < 10; j++)

      if (j % 2 == 0) fork();

    return 0;


The total number of child process formed is __________ .

  1. 31
  2. 63
  3. 5
  4. 6

Ans: a

Explanation: Condition “if” will be satisfy for j = 0, 2, 4, 6, 8 only. So, "fork()" will call five times.

The total number of processes formed are,

= 2number of fork()

There is only one parent process of these processes and the remaining will be child processes.

Hence the number of child processes created is,

= 2number of fork() - 1

= 25 - 1

= 32 - 1

= 31

So, option (a) is correct.

9. Consider an arbitrary set of CPU-bound processes with unequal CPU burst lengths

submitted simultaneously to a system. Among the following, which process scheduling algorithms would minimize the average waiting time in the ready queue?

  1. Shortest remaining time first
  2. Round-robin having time quantum less than the shortest CPU burst
  3. Uniform random
  4. Highest priority first with priority proportional to the CPU burst length

Ans: a

Explanation: Turnaround time is the process's total time between starting and completion. The waiting time is when the process is ready to run but not executed by the CPU scheduler. Since we know, in all CPU Scheduling algorithms, the shortest job first is optimal, It gives minimum turn round time, minimum average waiting time, and high throughput and the most important thing is that the shortest remaining time is the pre-emptive version of the shortest job. The shortest remaining time first scheduling algorithm, may lead to starvation. If the short processes are added to the CPU scheduler continuously, then the currently running process will never be able to execute as they will get pre-empted. Still, all the processes arrived simultaneously, so there will be no issues such as starvation.

So, the answer is Shortest remaining time first, which is the answer (a).

10. At a particular time, the value of a counting semaphore is 10, it will become 7 after:

  1. 3 V operations
  2. 3 P operations
  3. 5 V operations and 2 P operations
  4. 2 V operations and 5 P operations

Which of the following option is correct?

  1. Only 2
  2. Only 4
  3. Both 2 and 4
  4. None of these

Ans: c

Explanation: P: Wait operation decrements the value of the counting semaphore by 1.

V: Signal operation increments the value of counting semaphore by 1.

Current value of the counting semaphore = 10

a) after 3 P operations, value of semaphore = 10-3 = 7

d) after 2 v operations, and 5 operations value of semaphore = 10 + 2 – 5 = 7

Hence option (c) is correct.

Frequently Asked Questions

  1. What does process management do in an operating system?
    Process management involves various tasks like creation, scheduling, termination of processes, and a deadlock. The process is a program that is under execution, which is an important part of modern-day operating systems. The OS must allocate resources that enable processes to share and exchange information.
  2. What are the five main activities of an OS regarding process management?
    Five major process management activities are Program execution, I/O operations, File system manipulation, Communications, and Error detection.
  3. How an OS manages the life cycle of a process?
    The OS executes the processes according to the scheduling algorithm. CPU scheduling information contains information about the operating system currently using the scheduling. Each process needs some I/O devices for its execution. The details of the I/O devices are stored in the I/O information attribute.
  4. What is a deadlock in an operating system?
    In an operating system, a deadlock occurs when a process or thread enters a waiting state because a requested system resource is held by another waiting process, which is waiting for another resource held by another waiting process.
  5. What types of status can a process have?
    The Process States can be ready, running, waiting, or terminated. The process is waiting in the ready queue to be assigned to a processor in the ready state. In running state, Instructions are being executed. In a waiting state, the process is waiting for some event (such as an I/O completion or reception of a signal). And lastly, in a terminated state, the process has finished execution.


This article exclusively discussed various GATE questions on process management in Operating systems. This article has the solution and explanation of these GATE questions.

Recommended Readings:

Refer to this link to know more about process management in detail.

We hope that this blog helped you in enhancing your knowledge regarding memory management in operating systems, and in case you would like to learn more, check out our articles in the code studio library. Please upvote our blog to help other ninjas grow. Happy Coding!

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Live masterclass