What an Operating System Is: Privilege and System Calls · seed 1 · A4, ink-friendly. The answer key prints on its own page for grown-ups.
به انگلیسی

User mode, kernel mode and checked requests

Computing · Computer Systems · ages 19-20
Name ______________________   Date ____________
  1. In the lesson's model, which direct CPU action is restricted to privileged code?

    • Add two values held in ordinary registers
    • Change memory-protection control registers
    • Compare two values held in ordinary registers
  2. In the lesson's protected user/kernel model, how does an ordinary app save a file?

    • Request a file service from the OS
    • Issue storage commands without OS checks
    • Disable protection and write the disk itself
  3. A program calls a library function that requests a file read from the OS. All execution while handling this call stays in user mode.

    Circle one:   True   False

  4. Why restrict user programs from changing memory protection or issuing unrestricted device commands?

    • Such access could damage another program's data
    • Such access would make every request automatically safe
    • Such access would remove every need for shared resources
  5. Which sequence follows the lesson's file-read system-call model?

    • Read the device first, enter kernel mode, then prepare the request
    • Prepare the request, return to user mode, then enter the kernel
    • Prepare the request, enter the kernel, handle it, return to user mode
  6. An app has permission to create a folder. A student says this lets the app execute privileged CPU instructions itself. Which correction fits?

    • Folder permission lets the app bypass all memory protection
    • The app requests a service; the kernel performs protected work
    • Folder permission makes all the app's later execution kernel code
  7. An empty desktop disk will hold ordinary office apps that require OS services. What should be installed before those apps?

    • A suitable OS providing the services they require
    • The office apps so they can create their own OS
    • Only a compiler, regardless of the apps' OS requirements
  8. A file-read system call enters the kernel, but the program lacks permission to read the file. Which outcome fits the lesson?

    • Kernel entry gives the program permission to read every file
    • Kernel entry disables the checks for this particular request
    • The kernel can reject the request and return an error
LightMySky · lightmysky.comW1-mt_0kMavEKxpX-s1

Answer key

For grown-ups. Fold this page away before handing over the rest.

User mode, kernel mode and checked requests W1-mt_0kMavEKxpX-s1

  1. Change memory-protection control registers · Changing memory-protection control registers changes hardware protection. Ordinary arithmetic and comparisons do not require that privilege.
  2. Request a file service from the OS · The app requests an OS file service. It does not gain unrestricted storage-device control.
  3. False · The library function requests a kernel service through a system call. Execution enters kernel mode for that service and later returns to user mode.
  4. Such access could damage another program's data · Unrestricted control can let one program interfere with another. Protection and checked interfaces reduce that risk.
  5. Prepare the request, enter the kernel, handle it, return to user mode · The request is prepared before entry. Kernel handling occurs before return to user mode.
  6. The app requests a service; the kernel performs protected work · Permission to request folder creation does not grant CPU privilege. The service can enter the kernel while the app remains user-mode software.
  7. A suitable OS providing the services they require · These specified apps require OS services, so install a suitable OS first. This does not mean firmware or bare-metal programs need an installed OS.
  8. The kernel can reject the request and return an error · Controlled entry does not approve the request. File permissions can cause the kernel to return an error.
Worksheet · LightMySky