Docsity

Operating System Structures: Practice Exercises, Exercises of Operating Systems

Toggle sidebar
bg1
2
CHAPTER
Operating-
System
Structures
Practice Exercises
2.1 What is the purpose of system calls?
Answer:
System calls allow user-level processes to request services of the operat-
ing system.
2.2 What are the five major activities of an operating system with regard to
process management?
Answer:
The five major activities are:
a. The creation and deletion of both user and system processes
b. The suspension and resumption of processes
c. The provision of mechanisms for process synchronization
d. The provision of mechanisms for process communication
e. The provision of mechanisms for deadlock handling
2.3 What are the three major activities of an operating system with regard
to memory management?
Answer:
The three major activities are:
a. Keep track of which parts of memory are currently being used and
by whom.
b. Decide which processes are to be loaded into memory when
memory space becomes available.
c. Allocate and deallocate memory space as needed.
2.4 What are the three major activities of an operating system with regard
to secondary-storage management?
Answer:
The three major activities are:
5
pf3
pf4

Partial preview of the text

Download Operating System Structures: Practice Exercises and more Exercises Operating Systems in PDF only on Docsity!

Operating- C H A P T E R

System

Structures

Practice Exercises

2.1 What is the purpose of system calls? Answer: System calls allow user-level processes to request services of the operat- ing system. 2.2 What are the five major activities of an operating system with regard to process management? Answer: The five major activities are:

a. The creation and deletion of both user and system processes b. The suspension and resumption of processes c. The provision of mechanisms for process synchronization d. The provision of mechanisms for process communication e. The provision of mechanisms for deadlock handling

2.3 What are the three major activities of an operating system with regard to memory management? Answer: The three major activities are:

a. Keep track of which parts of memory are currently being used and by whom. b. Decide which processes are to be loaded into memory when memory space becomes available. c. Allocate and deallocate memory space as needed.

2.4 What are the three major activities of an operating system with regard to secondary-storage management? Answer: The three major activities are:

5

6 Chapter 2 Operating-System Structures

  • Free-space management.
  • Storage allocation.
  • Disk scheduling.

2.5 What is the purpose of the command interpreter? Why is it usually separate from the kernel? Answer: It reads commands from the user or from a file of commands and executes them, usually by turning them into one or more system calls. It is usually not part of the kernel since the command interpreter is subject to changes. 2.6 What system calls have to be executed by a command interpreter or shell in order to start a new process? Answer: In Unix systems, a fork system call followed by an exec system call need to be performed to start a new process. The fork call clones the currently executing process, while the exec call overlays a new process based on a different executable over the calling process. 2.7 What is the purpose of system programs? Answer: System programs can be thought of as bundles of useful system calls. They provide basic functionality to users so that users do not need to write their own programs to solve common problems. 2.8 What is the main advantage of the layered approach to system design? What are the disadvantages of using the layered approach? Answer: As in all cases of modular design, designing an operating system in a modular way has several advantages. The system is easier to debug and modify because changes affect only limited sections of the system rather than touching all sections of the operating system. Information is kept only where it is needed and is accessible only within a defined and restricted area, so any bugs affecting that data must be limited to a specific module or layer. 2.9 List five services provided by an operating system, and explain how each creates convenience for users. In which cases would it be impossible for user-level programs to provide these services? Explain your answer. Answer: The five services are:

a. Program execution. The operating system loads the contents (or sections) of a file into memory and begins its execution. A user-level program could not be trusted to properly allocate CPU time. b. I/O operations. Disks, tapes, serial lines, and other devices must be communicated with at a very low level. The user need only specify the device and the operation to perform on it, while the system converts that request into device- or controller-specific commands. User-level programs cannot be trusted to access only devices they

8 Chapter 2 Operating-System Structures

certain locations of the hard disk to be recognized during system startup. Boot managers often provide the user with a selection of systems to boot into; boot managers are also typically designed to boot into a default operating system if no choice is selected by the user.