Process Description and Control
3.1: What is an instruction trace?
An instruction trace for a program is the sequence of instructions that execute for that process.
3.2: Explain the concept of a process and mark its differences from a program.
(GPT)A process is an active instance of a program running in the computer's memory, utilizing system resources like memory and CPU time. Two essential elements of a process are program code and a set of data associated with that code. In contrast, a program is a static collection of instructions stored on a storage medium, waiting to be loaded and executed as a process.
3.7: List four characteristics of a suspended process.
- The process is not immediately available for execution.
- The process may or may not be waiting on an event. If it is, this blocked condition is independent of the suspend condition, and occurrence of the blocking event does not enable the process to be executed.
- The process was placed in a suspended state by an agent; either itself, a parent process, or the operating system, for the purpose of preventing its execution.
- The process may not be removed from this state until the agent explicitly orders the removal.
3.9: What are the elements of a process image?
- Program: a process must include a program or set of programs to be executed.
- Data: Associated with these programs is a set of data locations for local and global variables and any defined constants.
- Stack: In addition, the execution of a program typically involves a stack that is used to keep track of procedure calls and parameter passing between procedures.
- Attributes: Finally, each process has associated with it a number of attributes that are used by the OS for process control. Typically, the collection of attributes is referred to as a process control block.
3.11: What are the steps performed by an OS to create a new process?
- Assign a unique process identifier to the new process.
- Allocate space for the process.
- Initialize the process control block.
- Set the appropriate linkages.
- Create or expand other data structures.
3.13: Give three examples of an interrupt.
Clock interrupt, I/O interrupt, memory fault.
Threads
4.2: List reasons why a mode switch between threads may be cheaper than a mode switch between processes.
- Less state information is involved.
- Shared memory
- Reduced context switching
- Faster synchronization mechanisms.
4.3: What are the two separate and potentially independent characteristics embodied in the concept of process?
Resource ownership and scheduling/execution.
4.4: Give four general examples of the use of threads in a single-user multiprocessing system.
Foreground/background work; asynchronous processing; speedup of execution by parallel processing of data; modular program structure.
4.5: How is a thread difference from a process?
The key benefits of threads derive from the performance implications:
- It takes far less time to create a new thread in an existing process, than to create a brand-new process.
- It takes less time to terminate a thread than a process.
- It takes less time to switch between two threads within the same process than to switch between processes.
- Threads enhance efficiency in communication between different executing programs. In most operating systems, communication between independent processes requires the intervention of the kernel to provide protection and the mechanisms needed for communication. However, because threads within the same process share memory and files, they can communicate with each other without invoking the kernel.
4.6: What are the advantages of using multithreading instead of multiple processes?
(GPT)Advantages of multithreading over multiple processes include efficient resource sharing, faster communication, reduced memory overhead, simplified programming, and improved scalability.
标签:What,processes,Process,memory,System,process,program,Operating,between From: https://www.cnblogs.com/avananami/p/17477835.html