PROCESS MANAGEMENT II Flashcards
What are some of the scenarios in which a process would leave the running queue apart from termination
-The process could issue an I/O request and then be
placed in an I/O queue.
-The process could create a new sub process and wait for the sub process’s termination.
-The process could be removed forcibly from the CPU, as a result of an interrupt, and be put back in the ready queue.
Illustrate Process Scheduling
*See notes
Describe process creation
A process may create several new processes, via a create- process system call, during the course of execution. The creating process is called a parent process, and the new processes are called the children of that process. Each of these new processes may in turn create other processes,
forming a tree of processes.
What are the possibilities, in terms of execution, when a process creates a new process
The parent continues to execute concurrently with its
children.
The parent waits until some or all of its children have
terminated.
What are the possibilities, in terms of address space allocation, when a process creates a new process
The child is a duplicate of the parent (same program and data)
The child has a new program loaded into it
What typically happens when a process terminates?
A process terminates when it finishes executing its final statement and asks the operating system to delete it by using the exit () system call.
At that point, the process may return a status value
(typically an integer) to its parent process (via the wait() system call).
All the resources of the process—including physical and virtual memory, open files, and I/O buffers—are
deallocated by the operating system
Other than the completion of execution, in what other circumstance can a process terminate?
Termination can occur in other circumstances as well. A process can cause the termination of another process via an appropriate system call (for example, TerminateProcess() in Win32).
Usually, such a system call can be invoked only by the parent of the process that is to be terminated.
Give examples of reasons why a parent may terminate its child process
The child has exceeded the usage of some of the resources it has been allocated
The task assigned to the child is no longer required
The parent is exiting and the OS does not allow a child to continue if it terminates
When is a process said to be independent and when is it said to be cooperating
A process is independent if it cannot affect or be
affected by the other processes executing in the system. Any process that does not share data with any other process is independent.
A process is cooperating if it can affect or be affected by the other processes executing in the system
Give some reasons for providing an environment that allows process cooperation:
Information sharing.
Since several users may be interested in the same piece of information (for instance, a shared file), we must provide an environment to allow concurrent access to such information.
Computation speedup.
If we want a particular task to run faster, we must break it into subtasks, each of which will be executing in parallel with the others. Notice that such a speedup can be achieved only if the computer has multiple processing elements (such as CPUs or I/O channels).
Modularity.
We may want to construct the system in a modular
fashion, dividing the system functions into separate
processes or threads.
Convenience.
Even an individual user may work on many tasks at the same time. For instance, a user may be editing,
printing, and compiling in parallel.
What are the two fundamental models of inter-process communication:
Shared memory
In the shared-memory model, a region of memory that is shared by cooperating processes is established. Processes can then exchange information by reading and writing data to the shared region.
Message passing.
In the message passing model, communication takes place by means of messages exchanged between the cooperating processes.
Compare and contrast message passing and shared memory
Message passing is useful for exchanging smaller amounts of data, because no conflicts needs to be avoided.
Message passing is also easier to implement than is shared memory for intercomputer communication.
Shared memory allows maximum speed and convenience of communication, as it can be done at memory speeds when within a computer.
Shared memory is faster than message passing, as
message-passing systems are typically implemented using system calls and thus require the more time consuming task of kernel intervention.
What are the different types of communication between process
Direct communication
Indirect communication
Describe direct communication
Each process that wants to communicate must explicitly name the recipient or sender of the communication.
In this scheme, the send() and receive() primitives are defined as:
-send(P, message)—Send a message to process P.
-receive (Q, message)—Receive a message from process Q
What are the properties of a communication link in direct communication scheme
A link is established automatically between every pair of processes that want to communicate. The processes need to know only each other’s identity to communicate.
A link is associated with exactly two processes.
Between each pair of processes, there exists exactly one link.