1. Home
  2. Explore
  3. Computer Science
  4. Memory Management in OS

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Memory Management in OS

  • 17Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Memory Management Basics

What is the primary focus of memory management in an operating system?

17 questions

  1. 1

    What is the primary focus of memory management in an operating system?

    1. A

      Managing the input/output devices connected to the system

    2. B

      Managing the CPU registers and cache memory

    3. C

      Managing only the secondary memory to store programs

    4. D

      Managing all types of memory resources efficiently, especially primary memory

    Correct answer
    D

    Managing all types of memory resources efficiently, especially primary memory

    Explanation

    Memory management focuses on efficiently managing various memory resources, with special emphasis on primary memory (RAM) because it directly affects system performance and cost.

  2. 2

    Why is memory management particularly concerned with primary memory (RAM)?

    1. A

      Because RAM stores all programs permanently and needs organization

    2. B

      Because RAM is directly connected to the CPU and its size impacts performance and cost

    3. C

      Because RAM is slower than cache and registers, requiring management for speed

    4. D

      Because RAM is the most expensive memory and requires careful allocation

    Correct answer
    B

    Because RAM is directly connected to the CPU and its size impacts performance and cost

    Explanation

    RAM is directly connected to the CPU and its size affects both system cost and performance. Increasing RAM size improves multiprogramming but also increases cost, so it must be managed carefully.

  3. 3

    Which of the following memories are directly connected to the CPU?

    1. A

      RAM, registers, and secondary memory

    2. B

      RAM, hard disk, and cache

    3. C

      Registers, cache, and RAM

    4. D

      Registers, cache, and hard disk

    Correct answer
    C

    Registers, cache, and RAM

    Explanation

    The CPU is directly connected to registers, cache, and RAM (primary memory). Secondary memory like hard disks is not directly connected due to speed differences.

  4. 4

    Why is secondary memory not directly connected to the CPU?

    1. A

      Because secondary memory is too expensive to be connected directly

    2. B

      Because secondary memory is non-volatile and cannot interact with the CPU

    3. C

      Because secondary memory is much slower than the CPU, causing a speed mismatch

    4. D

      Because secondary memory requires a separate controller that the CPU cannot access

    Correct answer
    C

    Because secondary memory is much slower than the CPU, causing a speed mismatch

    Explanation

    Secondary memory (e.g., hard disk) is significantly slower than the CPU, so a direct connection would create a bottleneck. Faster memories like RAM, cache, and registers are placed in between.

  5. 5

    What is the role of secondary memory in program execution?

    1. A

      It provides high-speed storage for frequently used data

    2. B

      It is where the CPU directly fetches instructions from

    3. C

      It temporarily holds data currently being used by the CPU

    4. D

      It stores all programs and processes that are waiting to be executed

    Correct answer
    D

    It stores all programs and processes that are waiting to be executed

    Explanation

    Secondary memory (e.g., hard disk) stores all programs. When a program needs to be executed, it is brought into primary memory so the CPU can access it.

  6. 6

    To execute a program stored in secondary memory, where must it be brought first?

    1. A

      Into the cache memory

    2. B

      Into the RAM (primary memory)

    3. C

      Into the secondary memory itself

    4. D

      Into the CPU registers

    Correct answer
    B

    Into the RAM (primary memory)

    Explanation

    Since the CPU is not directly connected to secondary memory, programs must be loaded into RAM first so the CPU can interact with and execute them.

  7. 7

    What is the Degree of Multiprogramming?

    1. A

      The number of processes that can be stored in secondary memory

    2. B

      The number of processes that are loaded into RAM for execution

    3. C

      The percentage of CPU time spent on executing processes

    4. D

      The total number of I/O operations performed by a process

    Correct answer
    B

    The number of processes that are loaded into RAM for execution

    Explanation

    Degree of Multiprogramming refers to the number of processes residing in RAM (main memory) at a given time. Higher degree means more processes are ready for CPU execution.

  8. 8

    How does increasing the Degree of Multiprogramming affect CPU utilization?

    1. A

      CPU utilization decreases because more processes compete for CPU time

    2. B

      CPU utilization remains the same because processes are executed sequentially

    3. C

      CPU utilization increases because the CPU is less likely to idle while waiting for I/O

    4. D

      CPU utilization increases only if the processes are CPU-bound

    Correct answer
    C

    CPU utilization increases because the CPU is less likely to idle while waiting for I/O

    Explanation

    With more processes in RAM, when one process performs I/O, the CPU can execute another process, reducing idle time and thus increasing CPU utilization.

  9. 9

    In the context of multiprogramming, what does the variable 'K' typically represent in the CPU utilization formula?

    1. A

      The fraction of time a process spends doing I/O operations

    2. B

      The number of processes in the ready queue

    3. C

      The size of the process in megabytes

    4. D

      The number of I/O devices attached to the system

    Correct answer
    A

    The fraction of time a process spends doing I/O operations

    Explanation

    K represents the fraction of time a single process spends on I/O operations. For example, if a process spends 70% of its time on I/O, then K = 0.7.

  10. 10

    If a process spends 30% of its time on I/O (K = 0.3) and there is only one process in RAM, what is the CPU utilization?

    1. A

      30%

    2. B

      9%

    3. C

      100%

    4. D

      70%

    Correct answer
    D

    70%

    Explanation

    With one process, CPU utilization = 1 - K = 1 - 0.3 = 0.7 = 70%.

  11. 11

    What is the general formula for CPU utilization when n processes are in memory, each spending fraction K on I/O?

    1. A

      1−nK1 - nK1−nK

    2. B

      1−Kn1 - K^n1−Kn

    3. C

      n(1−K)n(1-K)n(1−K)

    4. D

      1−(1−K)n1 - (1-K)^n1−(1−K)n

    Correct answer
    B

    1−Kn1 - K^n1−Kn

    Explanation

    CPU utilization = 1 - (probability all processes are doing I/O simultaneously) = 1−Kn1 - K^n1−Kn.

  12. 12

    If K = 0.7 and n = 4, what is the approximate CPU utilization?

    1. A

      94%

    2. B

      30%

    3. C

      76%

    4. D

      51%

    Correct answer
    C

    76%

    Explanation

    1−0.74=1−0.2401=0.7599≈76%1 - 0.7^4 = 1 - 0.2401 = 0.7599 \approx 76\%1−0.74=1−0.2401=0.7599≈76%.

  13. 13

    According to the numerical example, what happens to CPU utilization as RAM size is increased while keeping process size constant?

    1. A

      CPU utilization remains the same because the CPU speed is unchanged

    2. B

      CPU utilization decreases because more processes introduce overhead

    3. C

      CPU utilization increases because more processes can be accommodated, reducing idle time

    4. D

      CPU utilization initially increases but then decreases after a certain point

    Correct answer
    C

    CPU utilization increases because more processes can be accommodated, reducing idle time

    Explanation

    Increasing RAM size allows higher degree of multiprogramming, which increases CPU utilization as shown by the formula 1−Kn1 - K^n1−Kn.

  14. 14

    Which of the following is NOT a responsibility of memory management in an operating system?

    1. A

      Deallocating memory when processes terminate

    2. B

      Ensuring security by preventing processes from interfering with each other's memory

    3. C

      Allocating memory to processes

    4. D

      Scheduling processes on the CPU

    Correct answer
    D

    Scheduling processes on the CPU

    Explanation

    Memory management handles allocation, deallocation, and security (protection) of memory. CPU scheduling is a separate function of the operating system.

  15. 15

    Why is security an important concern in memory management?

    1. A

      To prevent users from deleting system files

    2. B

      To protect the operating system from viruses

    3. C

      To prevent processes from reading each other's data by limiting access to allocated memory regions

    4. D

      To ensure that processes cannot be interrupted during execution

    Correct answer
    C

    To prevent processes from reading each other's data by limiting access to allocated memory regions

    Explanation

    When multiple processes are in memory, one process might accidentally or maliciously access another's memory space. Memory management enforces protection so each process can only access its own allocated region.

  16. 16

    What is a potential drawback of bringing an entire process into RAM as a single block?

    1. A

      It wastes memory if only a small part of the process is needed, and loading the whole block consumes bandwidth

    2. B

      It increases the degree of multiprogramming too much

    3. C

      The process cannot be swapped out once loaded

    4. D

      The process may be too small to execute efficiently

    Correct answer
    A

    It wastes memory if only a small part of the process is needed, and loading the whole block consumes bandwidth

    Explanation

    Loading an entire process (e.g., 4MB) when only a few bytes are needed is inefficient. It uses memory and bus bandwidth unnecessarily. Paging and segmentation address this by loading only required blocks.

  17. 17

    Which techniques are mentioned as ways to avoid loading entire processes into memory?

    1. A

      Demand paging and virtual memory

    2. B

      Swapping and caching

    3. C

      Fragmentation and compaction

    4. D

      Paging and segmentation

    Correct answer
    D

    Paging and segmentation

    Explanation

    The content specifically mentions paging and segmentation as techniques to divide processes into smaller blocks that can be loaded as needed.

Question 1 of 17
Question 1 of 17

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent