MainMemory Flashcards

1
Q

For proper system operation, what measures must be taken to protect the operating system from user processes and vice versa, and how is this protection provided by the hardware?

A

Protection of the operating system from user processes and vice versa is crucial. Hardware implements this protection using registers, specifically the base and limit registers. These registers establish separate memory spaces for each process, preventing unauthorized access. The base register holds the smallest legal physical memory address, while the limit register specifies the size of the memory range, ensuring processes can only access designated addresses.

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

What is the significance of having a separate memory space for each process, and how is this separation achieved using registers?

A

Separate per-process memory space is crucial for protecting processes from each other, enabling concurrent execution. The base register holds the smallest legal physical memory address, and the limit is determined dynamically based on the size of the address space. By comparing addresses generated in user mode with the base register, the CPU hardware ensures protection. Any attempt to access unauthorized memory results in a trap to the operating system, preventing unwanted modifications.

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

How is memory binding implemented, and what are the stages in the address representation process?

A

Memory binding involves translating high-level symbolic addresses to concrete memory locations during program execution. The stages in address representation are: 1. Source Program: Symbolic addresses (e.g., variable names) are used. 2. Compiler: Converts symbolic addresses to relocatable addresses, expressed as module-specific offsets. 3. Linker or Loader: Binds relocatable addresses to absolute addresses, producing the final executable. Address spaces include symbolic, relocatable, and absolute addresses. Compiler mapping and linker/loader binding ensure proper organization and allocation.

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

What is the distinction between logical and physical address space, and how is the runtime mapping between them accomplished using the memory management unit (MMU)?

A

A CPU-generated address is a logical address, while the one loaded into the memory unit is a physical address. The runtime mapping is done by the MMU, using a relocation register to dynamically adjust logical addresses to physical addresses. The logical address space, running from 0 to max, is mapped to a separate physical address space. This mapping is crucial for memory management, preventing user programs from directly accessing physical memory locations of the operating system or other users.

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

What is dynamic loading, and in what scenarios is it particularly beneficial?

A

Dynamic loading is a mechanism where a program or module is loaded into memory at runtime instead of during program start-up. It offers flexibility and efficiency in system resource usage, especially when certain program components may not be immediately needed. Dynamic loading allows modules to be loaded on-demand, optimizing resource utilization.

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

What characterizes contiguous memory allocation, and how are processes allocated memory in this scheme?

A

Contiguous memory allocation involves placing each process in a single, contiguous section of memory. In this scheme, processes are loaded sequentially, with each process located next to the previous one in memory. When a process is allocated space, it competes for CPU time, and upon termination, it releases its memory for reallocation to other processes.

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

How is memory protection achieved in a system with a relocation register and a limit register, and what role does the CPU scheduler play in this context?

A

Memory protection is ensured by combining a relocation register and a limit register. The relocation register holds the smallest physical address, and the limit register specifies the range of logical addresses. The CPU hardware compares each user mode-generated address with these registers. The CPU scheduler, during process execution, loads the relocation and limit registers with the correct values as part of a context switch. This prevents the running process from modifying the operating system or other users’ programs and data.

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

What happens during memory allocation, and how does the system handle insufficient memory for an arriving process?

A

Memory allocation involves loading a process into memory to compete for CPU time. Upon termination, a process releases its memory for reallocation. In cases of insufficient memory for an arriving process, the system can reject the process with an error message or place it in a wait queue. When memory becomes available, the system checks the wait queue to satisfy the memory demands of waiting processes. Dynamic storage allocation strategies like first-fit, best-fit, and worst-fit are commonly used to select free holes.

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

What are the two types of memory fragmentation, and what are the solutions to address the problem of fragmentation?

A

There are two types of memory fragmentation: 1. External Fragmentation: Unused memory exists in small, non-contiguous blocks, complicating allocation of contiguous memory for larger processes. 2. Internal Fragmentation: Memory is allocated in fixed-sized blocks, leading to wasted space within allocated blocks. Solutions include compaction, which consolidates free memory into a large block, and paging, a technique allowing noncontiguous allocation of a process’s logical address space.

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

What is paging, and how does it address the issues of external fragmentation and compaction associated with contiguous memory allocation?

A

Paging is a memory management scheme that permits a process’s physical address space to be noncontiguous. It eliminates external fragmentation and the need for compaction by dividing physical memory into fixed-sized blocks called frames and logical memory into pages of the same size. A page table is used for address translation, mapping logical to physical addresses. Paging provides efficient memory usage and alleviates the challenges associated with contiguous memory allocation.

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

What are the basic components of paging hardware, and how does the translation process occur from logical to physical addresses?

A

Paging hardware involves breaking physical memory into frames and logical memory into pages. The steps in the translation process are: 1. Extract the page number and use it as an index into the page table. 2. Extract the corresponding frame number from the page table. 3. Replace the page number in the logical address with the frame number. The page size, defined by the hardware, is typically a power of 2, and the entire process ensures efficient address translation and memory access.

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

What are the advantages of using Translation Look-Aside Buffer (TLB) in a virtual memory system, and how does it accelerate address translation?

A

TLB is a hardware cache that stores recently translated virtual-to-physical address mappings. It accelerates address translation by providing quick access to the physical memory location corresponding to a virtual address, reducing the need for repeated translations in the page table. In case of a TLB miss, where the page number is not in the TLB, the address translation proceeds by referencing the page table. TLB entries are added for future references, and replacement policies handle full TLBs. TLB significantly improves memory access speed in virtual memory systems.

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

What measures are taken for memory protection in a paged environment, and how are protection bits associated with each frame in the page table utilized?

A

In a paged environment, memory protection is achieved through protection bits associated with each frame in the page table. Protection bits include read-write, read-only, and execute-only settings, offering fine-grained control over memory access. The valid-invalid bit in each page table entry indicates whether the page is in the process’s logical address space. This ensures efficient protection against illegal accesses, triggering traps to the operating system for address validation. Internal fragmentation issues are addressed by optimizing memory usage using a page-table length register (PTLR).

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

What is the concept of shared pages, and how does paging contribute to sharing common code among multiple processes?

A

Paging allows for the sharing of common code among multiple processes through the concept of shared pages. Multiple processes and their page tables can point to the same physical pages, ensuring that changes in the shared code are reflected across all processes. This mechanism enhances efficiency by reducing memory requirements, particularly beneficial in environments with numerous processes requiring identical libraries.

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

What are the different structures of page tables, and what are the advantages and considerations associated with hierarchical paging, hashed page tables, and inverted page tables?

A

Page table structures include: 1. Hierarchical Paging: Uses a multi-level page table structure, enabling efficient memory usage and quick access to specific page table entries. 2. Hashed Page Tables: Utilize a hash function to index into a hash table, handling collisions with linked lists. Suitable for variable-sized address spaces. 3. Inverted Page Tables: Maintain a single global table with entries for each occupied frame per process, optimizing memory use for shared memory systems. However, lookup time can be slower, and extra mechanisms are needed for shared physical pages. The choice depends on system requirements and characteristics.

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