Process termination :
A process terminates when it finishes executing its final statement and asks the operating system to delete it by calling the exit system call. At that point, the process may return data to its parent process (via the wait system call). All the resources of the process including physical and virtual memory, open the files and I/O buffers – are de allocated by the operating system.
- Process executes last statement and asks the operating system to delete it (exit)
- Output data from child to parent (via wait)
- Process’ resources are deal located by operating system
- Parent may terminate execution of children processes (abort)
- Child has exceeded allocated resources
- Task assigned to child is no longer required
- If parent is exiting : Some operating system do not allow child to continue if its parent terminates
- All children terminated – cascading termination
Process Scheduling Queues :
The objective of multiprogramming is to have some process running at all times, to maximize CPU utilization. The objective of time sharing is to switch the CPU among processes so frequently that users can interact with each program while it is running. A contemporary computer system maintains many scheduling queues. Here is a brief description of some of these queues:
Job Queue: As processes enter the system, they are put into a job queue. This queue consists of all processes in the system.
Ready Queue: The processes that are residing in main memory and are ready and waiting to execute are kept on a list called the ready queue. This queue is generally stored as a linked list. A ready-queue header contains pointers to the first and final PCBs in the list. Each PCB is extended to include a pointer field that points to the next PCB in the ready queue.
Device Queue: When a process is allocated the CPU, it executes for a while, and eventually quits, is interrupted or waits for a particular event, such as completion of an I/O request. In the case of an I/O request, the device may be busy with the I/O request of some other process, hence the list of processes waiting for a particular I/O device is called a device queue. Each device has its own device queue.