Quiz Flashcards
Linux memory area
- a chunk of virtual memory mapped to a VM area space structure
task_struct
- The OS stores process state in a data structure called process control block. There is one per process
called task_struct in linux
mm_struct
kernel’s representation of a process’s address space
important fields:
-mm_users = # of processes using the address space
-mm_count = main reference count; when the kernel operates on an address space, it bumps up the reference counter. all users = 1 count
-mmap and mm_rb: contain all the memory areas in this address space
pgd_t *pgd: physical address of the first thing in the pgd??? do we add the PGD offset to the start address of the PGD?
all of the mm_struct structures of every process are strung together in a doubly linked list via the mmlist field
vm_area_struct
describes a single memory area over a CONTIGUOUS VIRTUAL ADDRESS INTERVAL in a given address space
each VMA possesses certain permissions and associated operations
each VMA structure can represent different types of memory areas
important struct fields:
-VMA start (lowest address in the interval)
-vm_end (first byte AFTER the highest address in the interval)
length in bytes of memory area = vm_end - vm_start
pgd
the page global directory (pgd) which consists of an array of pgd_t types. The entries in the pgd point to entries in the second level directory, the PMD. The second-level page table is the page middle directory (PMD), which is an array of pmd_t types. Entries in the PMD point to entries in the PTE. Final level = page table; consists of page table entries of type pte_t. Page table entries point to physical pages
Difference between segmentation fault and protection fault?
- segmentation fault occurs when request and address is not in the VMA
- protection fault occurs when you don’t have permissions to access that address
memory mapping
- structure of data indicating how memory is laid out
anonymous file
a temporary file without a descriptor
swap file (swap space)
- portion of the memory used for virtual memory
shared object
- a file that contains binary code and data that can be loaded into memory and linked dynamically
shared area
- virtual memory that are shared by more than one process and then can be used by multiple programs simultaneously. Although virtual memory allows processes to have separate address spaces, there are times when you need processes to share memory.
copy-on-write
- copy file and save new only when wrote to otherwise access the same file
dynamic memory allocator
Maintains an area of a process’s virtual memory, known as heap
allocated memory
- allocated memory is memory that is filled
How does the VM system used for the execve function?
The shell stores the environment in memory and passes it to the execve() system call. The child process inherits it as an array pointer called environ