1. Anatomy of process Flashcards

1
Q

How the stack grows ?

A

It grows from high to low

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

What are the parts (pointers) of :
1. Memory stack
2. Registers

A

Memory :
1. SP
2. BP

Register:
1. General purpose registers for holding intermediate values

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

What are the parts of a process ?

A
  1. Stack
  2. Heap
  3. Data section
  4. Code/instruction section
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the characteristics of a process ?

A
  1. Has a PCB
  2. Has a PC
  3. Has a unique id
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Where is the program counter located and where is it pointing ?

A

It is located in the cpu and pointing to the current executed instruction in memory

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

What is a pointer function and where does it reside ?

A

Points to a memory address

It reside either in :
1. Stack
2. Data section
3. Heap

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

How many bytes an integer take in memory ?

A

32 bit system—> 4 bytes
64 —> 8 bytes

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

How many bytes does the cpu read when doing a memory access ?

A

Even though it asked for 4 bytes / 8 bytes (depending on system architecture) it will get 4 kb

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

What is a memory leak ?

A

A process allocate objects in the heap and never free them afterwards

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

What is a dangling pointer ?

A

Func 1 : has a pointer to x
Func 1 : called func 2
Func 2: has also a pointer to x
Func 2 pointer : free up x
Func 1: is pointing to something deallocated

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

Which is faster heap or stack ?

A

Stack is faster due to continuous memory allocation for local variables

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

What is escape analysis ?

A

Whenever possible allocate in the stack for local variable unless a variable/pointer has been returned it will be escape the stack and go to heap

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

Where does the process live at rest ?

A

It live at disk

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

What is the difference between sp and bs ?

A

Stack pointer move and change .
Base pointer provides us with a fixed reference.

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

When a stack overflow happens ?

A
  1. Large local variable
  2. Recursion
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the difference between a stack and heap in terms of functions accessibility to their variables ?

A
  1. Stack has local variables which are accessible just inside function local scope
  2. Heap allows for sending the objects it has created