slides03 Flashcards
1
Q
process
A
representation of a running program
2
Q
uniprogramming vs multiprogramming
A
- running more than one program at a time makes better use of time and resources - CPU and I/O not left waiting for chunks of time
- disadvantage of multiprogramming: CPU burns lots of cycles, higher energy usage
2
Q
process structure in memory
A
- stack: contains temp data (function parameters, return addresses, local variables)
- heap: contains dynamically allocated memory during runtime
- data: contains global variables; initialized data stored at bottom, unitialized data stored on top (takes up less space)
4.text: where program is loaded in binary
2
Q
CPU bound process
A
makes heavy use of CPU (eg. computing next prime number)
3
Q
I/O bound process
A
heavy data processing, need to read/write data from secondary storage
4
Q
process states
A
- new: process is being created
- running: instructions being executed
- ready: process waiting to be assigned to CPU
- waiting: waiting for some event (IO)
- terminated
5
Q
PCB (process control block) (7)
A
- stores information associated with each process
1. process state
2. program counter: address of instruction to execute next
3. CPU registers
4. CPU scheduling information
5. memory management information
6. accounting information
7. I/O status information
6
Q
does context switch need a memory save and restore? (3)
A
- save all memory onto disk (very time consuming)
- don’t save memory and trust the next process
- isolate memory from one process to another; they’re partitioned and don’t share memory space
7
Q
how to create a process?
A
- clone an existing process to create a new process using fork() - both user and kernel spaces are cloned
- mutate the process by loading another program to do required activity using exec() - user space wiped out, kernel space kept the same
8
Q
fork()
A
- non-zero return value in the parent process (PID of child)
- return value of 0 in child process
9
Q
process termination
A
- process uses exit() system call to ask OS to delete it
- process’ resources deallocated by OS
- returns status data from child to parent (retrieved in parent using wait())
10
Q
zombie program
A
- no parent is waiting once a process exits -> no way of recovering process ID
11
Q
processes and address spaces
A
- processes are isolated - they each have their own address space
- part of the address space is kernel - processes can share through it