Process development, scheduling, impasse management, and process termination are just a few of the tasks that fall under the umbrella of process management in OS. All of the system's continuing operations are managed by the operating system. The operating system controls processes by carrying out operations such as resource allocation and process scheduling. Both the CPU and RAM of a computer are utilized when a process is operating. The operating system also has to juggle all of the many computer functions.
What is a Process?
A process is when a software is run and its designated activities are carried out. It is an execution unit where a program is executed, to put it simply. The OS assists you in starting, stopping, and scheduling CPU-intensive processes. A child process is a process that the parent process creates.
The Process Control Block (PCB) facilitates easy control of process processes. It can be thought of as the process's brain since it has all the vital processing-related data, including the CPU registers, priority, state, and process id.
What is Process Management in OS?
The same shared resource is used by multiple processes in the process management system. Consequently, all actions and structures must be managed by the operating system in an efficient and effective manner.
Certain elements might need to be completed one operation at a time in order to maintain consistency. If not, there could be inconsistencies in the system and a potential stalemate.
The operating system is in charge of the following duties in terms of process management.
- CPU process and thread scheduling.
- It is possible to add and remove system and user processes.
- Procedures are halted and then restarted.
- Offering techniques to synchronize operations.
- Establishing channels of communication for procedures.
How Does a Process Look Like in Memory?
In memory, a process is separated into multiple distinct portions, each with a particular function. This is the general appearance of a process in memory.
Text Section: The current activity denoted by the value of the Program Counter is also included in a Process, also referred to as the Text Section.
Stack: Local variables, function parameters, and return addresses are examples of temporary data that are kept in the stack.
The global variable is contained in the data section.
Heap Section: Memory allotted to a process dynamically while it is running.
Characteristics of a Process
A procedure possesses the following qualities:
- Process Id: An individual number that the operating system assigns
- The state of the process could be running, ready, etc.
- Registers of the CPU: Similar to the Program Counter, when a process is switched in and out of the CPU, CPU registers need to be saved and restored.
- Account details: CPU usage for process execution, time constraints, execution ID, and so forth
- Information about I/O status: For instance, open files, devices assigned to the process, etc.
- Details on CPU scheduling: As an illustration, Priority Priorities may vary amongst processes; for instance, a shorter process might be given a higher priority under the shortest job first scheduling.
States of Process
A process can be in any of these states:
- New: Recently developed or in the process of being developed.
- Ready: Following the creation phase, the process enters the ready state, meaning it is prepared for execution.
- Running: The process that is presently executing on the CPU (a single processor can only execute one process at a time).
- When a process asks to access input or output, wait (or block).
- Complete (or Terminated): The operation of the process was finished.
- Put on hold Ready: Certain processes enter a paused ready state when the ready queue fills up.
- When there is a full waiting list, the block is suspended.
Process Operations
The several tasks an operating system (OS) carries out to manage processes are referred to as process operations. Among these operations are the creation, scheduling, execution, and termination of processes.
The following are the main process steps:
Process Creation
In an operating system (OS), creating a new process is known as process creation. An instance of an autonomously running program is this new process.
Scheduling
A process joins the "ready queue" when it is prepared to execute. Selecting a process from this queue and initiating its execution is the scheduler's responsibility.
Execution
When a process is executed, the CPU begins working on it. In this period, the procedure may:
If an I/O operation is required, go to a waiting list.
If a process with a higher priority requires the CPU, get blocked.
Killing the Process
The operating system terminates the process and deletes its Process Control Block (PCB) when it has completed its job.
Context Switching of Process
Context switching is the process of loading the context of one process while storing the context of another. To put it simply, it's similar to loading and unloading a process to get it from the running to the ready stage.
When Does Context Switching Happen?
Operating systems' core idea of context switching makes it possible to multitask and manage resources effectively. A multitasking operating system allows for the simultaneous operation of many processes, or threads. By employing context switching, the operating system divides up these threads, or processes, so that each can receive an equal share of CPU time.
The following data is saved and restored during OS context switching:
- The information kept in the CPU's registers, which represent the thread or process's current state.
- The memory map of a process or thread is a mapping of virtual memory locations to physical memory addresses.
- The stack of the process or thread, which holds the function call stack and other data required to continue running the program.
Context Switch vs Mode Switch
When a system call is performed or a failure occurs, for example, the CPU privilege level changes, resulting in a mode switch. A typical user job operates in a less privileged manner than the kernel. A mode switch needs to happen whenever a user process needs to access resources that are only available to the kernel. During a mode changeover, the process that is now running does not need to be altered. A process context switch usually requires a mode switch. A context transition can only be initiated by the kernel.
CPU-Bound vs I/O-Bound Processes
A CPU-bound process uses more CPU time or runs continuously for a longer period of time. More I/O time and less CPU time are needed for an I/O-bound process. A process that is I/O-bound stays in the waiting state longer.
An essential component of the operating system for process management is process planning. It alludes to the method by which the operating system chooses which process to execute next. Process scheduling aims to increase system reaction time, minimize execution time, and maximize CPU utilization in order to improve overall system performance.
Process Scheduling Algorithms
The operating system can schedule processes using a variety of scheduling strategies. The following are a few popular timing algorithms:
First-Come, First-Served (FCFS): This is the most basic scheduling technique in which participants are assigned a slot based on arrival time. Because FCFS is non-preemptive, a process will run continuously until it is completed or it needs input from external devices.
Shortest Job First (SJF):The process with the shortest burst time is chosen by the proactive scheduling technique known as Shortest Job First (SJF). The amount of time it takes for a process to finish running is called its burst time. Process average waiting times are reduced by SJF.
Round Robin (RR): This proactive scheduling technique allots a certain amount of time to each activity during a round. A process gets halted and moved to the end of the queue if it doesn't finish running in the allotted amount of time. By distributing CPU time evenly among all processes, RR prevents hunger.
Priority scheduling: Using this scheduling strategy, each process is given a priority, with the highest priority process running first. One can determine a process's priority by considering its type, significance, or resource needs.
Multilevel Queue: With this scheduling system, the ready queue is divided into many queues, each with a distinct priority. Each queue has its own scheduling algorithm, and processes are queued according to their priority. This scheduling strategy comes in use when there are disparities in the priority of several process types.
Advantages of Process Management
- By assigning jobs in a way that reduces idle time and maximizes throughput, processor management makes sure that the CPU is used effectively.
- Processor management can improve system responsiveness and user-friendliness by giving precedence to interactive or high-priority tasks.
- Process scheduling methods make ensuring that competing processes share CPU time equally and keep one process from taking up all of the system resources.
- The OS can handle multitasking thanks to CPU management, which makes it feasible for modern computers to run numerous apps at once.
- Real-time operating systems are appropriate for time-sensitive applications like robotics and embedded systems because they use processor management to make sure that important tasks are completed by the deadline.
Disadvantages of Process Management
- Overhead: Because the OS must maintain track of numerous data structures and scheduling queues, process management consumes system resources. The system's performance may be impacted by the CPU time and RAM needed for this.
- Complexity: The necessity for intricate scheduling algorithms and resource allocation techniques makes the design and maintenance of an operating system difficult.
- Deadlocks: The OS employs techniques like semaphores and mutex locks to prevent processes from crashing on one another. These, however, may result in deadlocks, wherein processes become trapped waiting on one another endlessly.
- Increased Context Switching: The OS constantly flips between processes on multitasking computers. The system may become slower as a result of the time and processing resources required to store and load each process's state (context switching).
Conclusion
In summary, process management plays a critical role in an operating system's ability to facilitate the seamless and effective operation of several programs. It entails managing resources, facilitating process communication, and initiating, scheduling, and ending processes. Efficient process management maximizes system resource use, preserves system stability, and improves computer responsiveness and overall performance. Maintaining a dependable and effective computer environment requires an understanding of and commitment to solid process management techniques.
What is process management in os?
One essential operating system function is process management. The operating system can guarantee stable operation and effective resource utilization by controlling processes. Furthermore, the operating system may regulate how programs communicate with one another thanks to process management.
What are the functions of OS in process management?
The operating system chooses a job and its processor, checks the processor's status, assigns the processor to the task, and releases the processor when the task is finished.
What are the five major activities of an OS in process management?
The five main activities are as follows:
Establishing and Ending Processes: Process Creation: New processes can be created using the operating system's mechanisms.
Procedure Planning
Procedure Harmonization
Procedure for Communication
Process Control and Management
What is the difference between memory management and process management?
The processor manager is in charge of managing the system's processes and allocating CPU resources. On the other hand, the memory of the system is controlled by the memory manager, which also handles virtual memory management, memory allocation, and deallocation.