Week 2 Flashcards
What is a process?
A process is the unit of work in a modern computing system.
What are the four sections of a process?
- Stack - contains temporary data
- Heap - contains memory which is dynamically allocated during run time
- Data - contains global variables
- Text - contains the program code
What is the difference between a program and a process?
A program is a passive entity that is stored on a disk where as a process is active and comes from a program when an executable file is loaded into memory. (One program can be several processes)
What are the five states of a process as it is executing?
- New - The process is being created
- Running - Instructions are being executed
- Waiting - The process is waiting for some event to occur
- Ready - The process is waiting to be assigned to a processor
- Terminated - The process has finished execution
What is a PCB?
A process control block (PCB) represents a process and contains many pieces of information relating to that process such as:
- Process state
- Program counter
- CPU registers
- CPU scheduling information
- Memory management information
- Accounting information
- I/O status information
What is process scheduling?
Process scheduling is where a process scheduler selects an available process for program execution on a core. Each CPU core can run one process at a time.
What are the two different types of scheduling queues?
- Ready queue - contains all processes residing in main memory waiting to execute
- Wait queue - contains processes waiting for an event to occur (i.e completion of I/O)
What is a context switch?
A context switch is performed when the CPU core needs to switch from one process to another. A save state is performed for the current process and a state restore is performed for a different process. The kernel saves the context of the old process and loads the saved new process scheduled to run
What is process creation?
Process creation is where a parent process creates new processes called children processes. Those children processes can than also create new processes. This creates a process tree.
What is a thread?
A thread is a segment of a process. A process can have multiple threads and most modern applications are multithreaded.
What are the 4 benefits of multithreading?
- Responsiveness - May allow continued execution if part of process is blocked, especially important for user interfaces
- Resource Sharing - Threads share resources of process
- Economy - cheaper than process creation, thread switching lower overhead than context switching
- Scalability - process can take advantage of multicore architectures
What does multicore / multithreaded programming provide?
Multicore and multithreaded programming provides a mechanism for more efficient use of multiple computing cores and provides improved concurrency.
What are the two types of parallelism?
Data parallelism - Distributes subsets of the same data across multiple cores, same operation on each
Task parallelism - Distributes threads across cores, each thread performing unique operation
What is the difference between concurrency and parrellism?
Concurrency supports more than one task making progress, parallelism implies a system can perform more than one task simultaneously.