Lecture 4: Processes Flashcards
define process
program in execution
5 parts in process
- text section (program code)
- program counter (current activity)
- heap (memory dynamically allocated during run time)
- data section containing global variables
- stack containing temporary data
5 states in process
- new: program being created
- running: instruction being executed
- waiting: process waiting for event to occur
- ready: process waiting to assign to processor
- terminate: process finish execution
what is process control block (PCB)
information associated with each process
- process state
- program counter
- CPU register
- CPU scheduling information
- memory management
- accounting information
- I/O status information
define process schedulling
quickly switch process onto CPU for time-sharing to maximize CPU use
3 scheduling queue
- job queue: set of all processes in system
- ready queue: set of processes in main memory, ready and waiting for execute
- device queue: set of processes waiting for I/O device
representation of process scheduling
- new process is put in ready queue, waiting for execution
- the process will be allocated the CPU and executed
- one of the events will occur
- process issue I/O request and enter I/O queue to waiting
- process create new child process and waiting for child to terminate
- process is removed from CPU. causing an interrupt, put back to ready queue
2 types of scheduler
long-term scheduler (job scheduler)
- select process to be bring into ready queue
- may be slow
- determine degree of multiprogramming
short-term scheduler (CPU scheduler)
- select process to be execute next and allocate CPU
- must be fast
I/O-bound process and CPU-bound process
I/O-bound process
- spend more time on I/O than computation
- many short CPU burst
CPU-bound process
- spend more time on computation
- few long CPU burst
define context switching
when CPU switches to another process, the system must saved the state of old process, and load the saved state for new process
define process creation
Parent process create children process, than continue to create other children process, forming a tree of processes
- process is identified and managed via process identifier (pid)
- 3 possible result of resource sharing
- 2 possible result of execution
- 2 possible result of address space
reasons for cooperating process
- sharing information
- convenient
- speedup computation
- modularity
two models of Interprocess Communication (IPC)
- shared memory
- message passing
two types of process
- independent (cannot affect or to be affected by other process execution)
- cooperating (can ‘’ )
define message passing
mechanism for process to communicate and synchronize the actions
- message system allow process to communicate with each other without resorting shared variable