- a program in execution
- a process contains -> program counter, process stacks & data section.
- process memory layout
Command Line Aruguments |
Stack |
Stack grows down & Heap grows Up |
Heap |
Data section (includes BSS) |
Text section |
CLA - command line arguments,stored at higher address
stack - local variables & other info (return info,machine register) stored. In each recursive call, new stack frame is created.
headp - dynamic memory allocation, shared to all process.
BSS - Block started by symbol (uninitialized global data)
data segment - initialized global variables
text - contains machine instrucitons that cpu executes, shared across various instances of same program. (read only privileges, avoid rewriting)
- process states
new - a process being created
ready - instructions are executed
waiting - waiting for some event
running - waiting to be assigned to processor
terminate(done) - process has finished
- zombie process – system is referencing the process even if process is terminated.
- info associated with each process
Process state
Program counter
CPU registers
CPU scheduling information
Memory-management information
Accounting information
I/O status information
- process queues - job , ready , device
- process scheduler
- Long term (job) - selects which process to put in ready queue (frequent invoked - very fast)
- Short term (cpu) - selects which process to execute & allocate CPU (infrequently invoked - very slow)
- context switch
- switching from one process to another, system saves the state of the one process & load the state of new process
- processes can be independent or cooperating
- cooperating process need IPC - shared memory , message passing
- advantage for co-operating process
- info sharing
- computation speedup
- convenient
- modularity
- message passing
- send /recieve
- establish connection
- blocking send / non-blocking
- shared memory
- producer consumer problem
No comments:
Post a Comment