Chapter 3: Processes Flashcards
What is a process?
The unit of work in a modern time-sharing system
List and define the 5 states
New - The process is being created.
Running - Instructions are being executed.
Waiting - The process is waiting for some event to occur (such as an I/O completion or reception of a signal).
Ready - The process is waiting to be assigned to a processor.
Terminated - The process has finished execution.
What state(s) can a process transition to from running?
waiting
blocked/ready
blocked/suspended
terminated
When a process is swapped out or suspended in secondary memory, what state does it have to transition to in order to be scheduled?
Ready/suspended
What three state(s) can process transition to ready?
suspended
waiting
running
In the UNIX state diagram, there is a user running state and a kernel running state. Why is this?
for dual mode, processes to run simultaneously.
What scheduler determines which process will be run by the CPU?
Short term scheduler
Describe long and short term scheduling
Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue. Is invoked very infrequently and can be slow. (seconds, minutes) Controls the degree of multiprogramming.
Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU.
Is invoked very frequently (milliseconds). Has to be fast.
What’s the difference between I/O and CPU bound processes?
I/O spends more time doing I/O than computations. Has many short CPU bursts.
CPU spends more time doing computations. Has few very long CPU bursts.
What happens to processes that are running and then request an I/O?
The processes are placed in an I/O queue.
Why are processes put in a swapped/ready state?
Because theres too much contention so it must wait.
What are some possible reasons that cause a process to give up the CPU or become blocked and eventually be moved to the ready queue?
Interrupts
What’s the importance of degree of multiprogramming?
It has make a careful selection and select a good process mix. I/O and CPU bound processes .
If all processes are I/O bound, the ready queue will almost always be empty, and the short-term scheduler will have little to do.
If all processes are CPU bound, the I/O waiting queue will almost always be empty, devices will go unused, and again the system will be unbalanced.
What operating systems don’t have long-term schedulers?
Unix and microsoft windows
What’s the idea behind medium-term scheduler?
To remove processes from memory and reduce the degree of multiprogramming and to possible add processes back into memory later using the swapping method. The key advantage of doing this is to improve the process mix or to free up memory.
Describe Context Switching
When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process.
Context-switch time is overhead; the system does no useful work while switching.
Time dependent on hardware support.
What resources does a child need to complete a task?
CPU time, memory, files, I/O devices
Give a characteristic of Independent and Cooperating processes
Independent process cannot affect or be affected by the execution of another process.
Cooperating process can affect or be affected by the execution of another process.
What are the advantages of Cooperating processes?
Information sharing
Computation speed-up
Modularity
Convenience
List and Define the two Interprocess Communication models
Message system – processes communicate with each other without resorting to shared variables.
Shared Memory- a region of memory is shared by co-operating processes.
How’s information exchanged through shared memory communication?
Through reading and writing to shared region.
How’s information exchanged through message system communication?
Through messages.
What are some characteristics of shared memory and message system communication?
Shared memory communication: Faster than message system communication.
Message system: Easier to implement, useful for exchanging small amounts of data, and Implemented using system calls and thus requires intervention of kernel.
What’s the difference between an unbounded buffer and a bounded buffer?
Unbounded: places no practical limit on the size of the buffer.
Bounded: assumes that there is a fixed buffer size.
Give a characteristic and name some properties of communication links in Direct Communication
Characteristic: Processes must name each other explicitly.
Properties of communication links:
Links are established automatically.
A link is associated with exactly one pair of communicating processes.
Between each pair there exists exactly one link
The link may be unidirectional, but is usually bi-directional.
Symmetric vs. Asymmetric
Give a characteristic and name some properties of communication links in Indirect Communication
Characteristics: Messages are directed and received from mailboxes (also referred to as ports)
Each mailbox has a unique id.
Processes can communicate only if they share a mailbox.
Properties of communication link:
Link established only if processes share a common mailbox.
A link may be associated with many processes.
Each pair of processes may share several communication links.
Link may be unidirectional or bi-directional.
List the operations of Indirect Communication
reate a new mailbox
send and receive messages through mailbox
destroy a mailbox
What are some reasons a parent may terminate the execution of a child?
Child has exceeded allocated resources.
Task assigned to child is no longer required.
All children terminated - cascading termination
What happens when a process is terminated?
Process executes last statement and asks the operating system to delete it (exit)
Output data from child to parent (via wait)
Process’ resources are deallocated by operating system
Describe process creation
Parent process create children processes, which, in turn create other processes, forming a tree of processes.
Give characteristics of resource sharing, execution, and address in process creation.
Resource sharing:
Parent and children share all resources
Children share subset of parent’s resources
Parent and child share no resources
Execution:
Parent and children execute concurrently
Parent waits until children terminate
Address Space: Child duplicate of parent
Child has a program loaded into it
Give some unix examples of process creation
fork system call creates new process
exec system call used after a fork to replace the process’ memory space with a new program
What are the two characteristics of execution that happen when a process creates a process?
The parent continues to execute concurrently with it’s children.
The parent waits until some or all of its children have terminated.
How are message passing systems implemented?
They are implementing with the use of system calls
Why is shared memory faster than message passing?
because message-passing systems are typically implemented using system calls and require the more time-consuming task of kernel intervention
What are some issues of shared memory?
cache coherency
What’s the difference between symmetry and asymmetry in direct communication?
Symmetry: both the sender process and the receiver process must name the other to communicate.
Asymmetry:only the sender names the recipient; the recipient is not required to name the sender.
What’s the disadvantage of symmetry and asymmetry schemes?
limited modularity of the resulting process definitions.
Changing the identifier of a process may necessitate examining all other process definitions.
What an advantage of the multiprocess approach?
Websites run in isolation from one another. If one website crashes, only its renderer process is affected; all other processes remain unharmed.
Define Sandbox in multiprocess
Access to disk and network I/O is restricted, minimizing the effects of any security exploits.
What is the purpose of remote procedure call?
calls information that is to be received.
What does the semantics of at most once mean in terms of remote procedure calls?
Only receives the first set of information set and none of the rest. This is to avoid duplicates and possible loss/corruption of data.