slides03 Flashcards

1
Q

process

A

representation of a running program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

process structure in memory

A
  1. stack: contains temp data (function parameters, return addresses, local variables)
  2. heap: contains dynamically allocated memory during runtime
  3. 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

CPU bound process

A

makes heavy use of CPU (eg. computing next prime number)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

I/O bound process

A

heavy data processing, need to read/write data from secondary storage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

process states

A
  1. new: process is being created
  2. running: instructions being executed
  3. ready: process waiting to be assigned to CPU
  4. waiting: waiting for some event (IO)
  5. terminated
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

does context switch need a memory save and restore? (3)

A
  1. save all memory onto disk (very time consuming)
  2. don’t save memory and trust the next process
  3. isolate memory from one process to another; they’re partitioned and don’t share memory space
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how to create a process?

A
  1. clone an existing process to create a new process using fork() - both user and kernel spaces are cloned
  2. mutate the process by loading another program to do required activity using exec() - user space wiped out, kernel space kept the same
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

fork()

A
  • non-zero return value in the parent process (PID of child)
  • return value of 0 in child process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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())
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

zombie program

A
  • no parent is waiting once a process exits -> no way of recovering process ID
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly