A process is a program in execution. A process contains program counter, stack, data section, text section, and heap. The program counter specifies the next instruction to execute.
The five process states are New, Ready, Running, Waiting, and Terminated. A process moves between these states during its execution.
admitted
The main transitions are New → Ready → Running → Terminated, while a running process may move to Waiting for an I/O operation and return to Ready after I/O completion.
Any four fields of a Process Control Block (PCB) are process state, program counter, CPU registers, and CPU scheduling information. The PCB stores the information required by the OS to manage a process.
A parent process is a process that creates another process, while the newly created process is called a child process. The PID provides a unique identification number for each process and is used to access its attributes in the kernel.
A parent may terminate a child process when the child has exceeded its allocated resources or when the task assigned to the child is no longer required.
| Symmetric Multiprocessing (SMP) | Asymmetric Multiprocessing |
|---|---|
| All processors are peers. | One processor acts as the boss processor. |
| Each processor can perform OS tasks. | The boss processor controls and assigns work to other processors. |
| There is no boss-worker relationship. | There is a boss-worker relationship. |
Concurrent processing means multiple processes or tasks can make progress at the same time. It occurs in multiprocessor systems and distributed processing environments.
In the CPU–I/O burst cycle, a process alternates between CPU execution and I/O waiting. Execution begins with a CPU burst, followed by an I/O burst, and this continues until the final CPU burst completes the process.
| Preemptive Scheduling | Non-Preemptive Scheduling |
|---|---|
| A running process can be forced to release the CPU. | A process keeps the CPU until it terminates or enters waiting state. |
| Scheduling can occur when a process moves from running to ready or waiting to ready. | Scheduling occurs when a process moves from running to waiting or terminates. |
| Example: higher-priority process can interrupt the current process. | Example: the current process continues until it voluntarily releases the CPU. |
A dispatcher is the OS module that gives CPU control to the process selected by the short-term scheduler. Dispatch latency is the time taken by the dispatcher to stop one process and start another process.
Four scheduling criteria are:
CPU Utilization
Throughput
Turnaround Time
Waiting Time
Response Time is another important criterion.
Turnaround time is the total time from the submission of a process until its completion. Waiting time is the amount of time a process spends waiting in the ready queue.
The convoy effect occurs in FCFS scheduling when a long process gets the CPU first and makes many shorter processes wait behind it. This can result in lower CPU and device utilization.
| Non-Preemptive SJF | Preemptive SJF |
|---|---|
| The process with the shortest CPU burst is selected. | The process with the shortest remaining CPU time is selected. |
| Once started, the process continues until its CPU burst finishes. | A running process can be preempted if a new shorter process arrives. |
| It does not interrupt the current process. | It is also called Shortest Remaining Time First (SRTF). |
The file specifically illustrates preemptive SJF where a newly arriving shorter process preempts the current process.
Starvation occurs when a low-priority process waits for a very long time because higher-priority processes continue to execute. It is resolved using aging, where the priority of the waiting process is gradually increased.
Time quantum is the fixed amount of CPU time given to each process in Round Robin scheduling. If it is too large, Round Robin behaves like FCFS; if it is too small, there will be more context switching and overhead. The notes describe Round Robin as giving each user's work a specific amount of time before moving to the next job.
A multilevel queue scheduling algorithm divides processes into different queues based on their type or characteristics. For example, queues may contain system processes, interactive processes, batch processes, and student processes.
The parameters include:
1. Number of queues
2. Scheduling algorithm for each queue
3. Method to determine when to upgrade a process
4. Method to determine when to demote a process
5. Method to determine which queue a process enters when it needs service.
| Hard Real-Time | Soft Real-Time |
|---|---|
| Has strict time constraints. | Does not require strictly bounded delays. |
| Critical tasks must be completed on time. | Critical real-time tasks are given higher priority. |
| Has bounded delay for input, execution, and output. | Missing a deadline is possible. |
| Used for critical applications. | Useful in multimedia, virtual reality, and similar applications. |
0 Comments