Stacks Flashcards

1
Q

Memory layout

A
  • Stack
  • Empty space where stacjj and dynamic heap data grows into
  • Dynamic Heap Data
  • Static Data
  • Literals
  • Instructions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Instructions (in memory layout)

A

Read only; executable
Initialized when process starts

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

Literals (in memory layout)

A

Read-only; not executable
Initialized when process starts

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

Static data (in memory layout)

A

Writable; not executable
Initialized when process starts

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

Dynamic Heap Data

A

Writable; not executable
Managed by programmer

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

Stack (in memory layout)

A

Writable; not executable
Managed automatically by compiler

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

When does the stack grow

A

Each time a function is called

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

When does the stack contract

A

Each time we return from a function

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

Cases where local variables need to be stored in stack memory

A

Not enough registers to hold local variables
The address operator “&” is applied to a local variable
Local variable is array or structure

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