Process Review (week 2) Flashcards

1
Q

process

A

running program

remember: the program itself just sits there (data, instructions, etc). it is the OS that gets it up and running into something useful, a process

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

how does OS provide the illusion of many CPUs?

A

by virtualizing the CPU.

by running one process, then stopping and running another, and so forth, the OS can promote the illusion that many virtual CPUs exist when in fact there is only 1 (or a few). this is called time-sharing.

cost: slower performance

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

what is the counterpart to time sharing?

A

space sharing. where a resource is divided; e.g., disk space is naturally a space shared resource

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

what is address space?

A

the memory that the process can address

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

what are the most important registers in a process?

A

program counter (PC): instruction pointer or IP, tells us which instruction of the program will execute next

stack pointer & frame pointer: used to manage the stack for function parameters, local variables and return addresses

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

what might I/O information contain?

A

programs often access persistent storage devices. this i/o information might include a list of the files the process currently has open.

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

What are some of the common process API’s that are available on any modern OS?

A
  1. create a process
  2. destroy: many processes exist on their on when complete, but this is useful when you have a runaway process
  3. wait: it can be useful to wait for a process to stop running
  4. misc. control: for e.g.: suspend a process and then resume
  5. status: get the status of a process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Use this image to explain process vs. program

A

Program is useless

Becomes a process when it is loaded from disk into memory by the OS and “runs”

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

briefly describe process creation.

A
  1. the OS loads process code (program) and any static data (e.g. initialized variables) into memory and address space of the process
    - -> programs start out on disk or sometimes on flash-based SSDs in some kind of executable format
    - -> modern OSes perform the process lazily, by loading pieces of code or data only as they are needed during program execution (paging and swapping policies!)
  2. once the OS loads the bits from disk to memory, some memory must be allocated for the program’s run-time stack. the OS allocates this memory and gives it to the process. the OS will also likely initialize the stack with arguments – fill in the parameters to the main() function, i.e., argc and the argv array
  3. the OS will probs allocate some memory for the program’s heap / dynamically allocated data; malloc() and free(). heap is needed for data structures. heap is small at first; as the program runs, and requests more memory via malloc() librabry API, the OS may get involved and allocate more memory to the process to help satisfy such calls
  4. other initialization tasks (like file descriptors for standard input, output, and error)
  5. now, the OS has set the stage for program execution. last, stats the program running at the entry point, main(). by jumping to the main() routine the OS transfers control of the CPU to the newly-created process. thus program begins execution
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what are the three states a process can be in?

A

ready
running
blocked

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

Describe some things the OS needs to keep track of.

A

process list: for all processes that are ready and some additional info to track which process is currently running
note: the OS must also track blocked processes; when an I/O event completes, the OS should make sure to wake the correct process and ready it to run again

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

what is the zombie state?

A

in UNIX – when a process has finished but has not been cleaned up yet

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

process control block

A

structure that contains information about a specific process

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