what is a process
an instance of a program being executed
what does contiguous mean
together
what does a process use
each process may use groups of locations that are not contiguous
what is each process allocated
each process is allocated its own portion of main memory by the operating system
where are global variables stored
data
what is stored in data
global variables
what is stored in stack
local variables, return addresses and parameter values
what is stored in heap
dynamically allocated objects (strings, arrays, lists)
what is the zone in between the stack and heap sections
the buffer
what is stored in text
code eg visual studio code
what are the 2 purposes of the call stack
what is step 1 of storing objects
the location of the first item is put into the stack
what is step 2 of storing objects
that location in the heap is found, along with the next one. They come as a pair
what is step 3 of storing objects
the first location is assigned a value
the second is left empty so it can be used to connect with another location
what is step 4 of storing objects
as more numbers are added, more locations in the heap are linked and filled
what is the role of the second linking location in the heap
its address registry links to others
where are variables stored
the stack only
where are objects stored
in the heap
where is object reference stored
in the stack
what is the heap
relatively unstructured pool of memory ready to use for storing data for objects
what happens when a new object is created in the heap
the heap grows in size
what happens when all references to an object no longer exists
the memory will be freed back to the unallocated pool
heap shrinks
what causes the heap to shrink
when all references to an object no longer exists
that memory will be freed back to the unallocated pool
what causes the memory to be freed back to the unallocated pool
when all references to an object no longer exists