OS: OperationgSystemStructures

Βασικές Δομές Λ.Σ.

This section is concerned with the operating system interfaces that users (or at least programmers) actually see: control cards and system calls. The treatment is somewhat vague since more detail requires picking a specific system to discuss. This chapter is best supplemented with exactly this detail for the specific system the students have at hand. They should study the control card (or command) semantics and syntax; ideally they should study the system calls and write some programs making system calls. This chapter also ties together several important concepts including layered design, virtual machines, system design and implementation, system generation, and the policy/mechanism difference.


Question

List system service functions provided for the convenience of the programmer. Tell what each does.

Answer

Program execution loads and executes programs, allows debugging I/O operations does all read and write operations File system management allows you to create, delete, open files, etc. Communications allows processes to communicate with each other Error detection CPU, hardware, instructions, device errors


Question

List system service functions provided for efficient operation of the system.

Answer


Question

How do systems-programming languages differ from other high-level languages?

Answer

Systems-programming languages allow system calls directly; they have provisions for accessing hardware components, such as registers. Other high-level languages don’t.


Question

List system calls used in a typical file-processing PL/I program.

Answer

Get, put, signal(finish), open, close. In more detail:

  1. Put prompt message
  2. Get file names
  3. Open files
  4. On error condition
  5. Put error message
  6. Write or Put into ?le created
  7. On end-of-file
  8. Put error message
  9. Read or Get file
  10. Put or Write file
  11. Put all-done message
  12. Close both files
  13. Delete source file
  14. Signal (Finish)

Question

Describe three methods for passing parameters needed by system calls.

Answer

  1. Pass parameters in registers
  2. Registers pass starting addresses of blocks of parameters
  3. Parameters can be placed, or pushed, onto the stack by the program, and popped off the stack by the operating system.

Question

List five or more functions to control processes and jobs.

Answer


Question

List eight or more functions for file manipulation.

Answer

Create, delete, open, close, read, write, and reposition files, get/set file attributes.


Question

List debugging aids for programmers.

Answer


Question

What is a time profile?

Answer

Shows amount of time executed by each instruction or block of instructions.


Question

List categories of systems programs.

Answer


Question

What is a command interpreter? By what other names is it known?

Answer

Program that interprets the commands you type in at terminal, or enter through a batch file; gets and executes next user-specified command. Names: control card interpreter, command line interpreter, console command processor, shell.


Question

How can command interpreters be implemented?

Answer


Question

What are the five major activities of an operating system in regard to process management?

Answer

  1. The creation and deletion of both user and system processes
  2. The suspension and resumption of processes
  3. The provision of mechanisms for process synchronization
  4. The provision of mechanisms for process communication
  5. The provision of mechanisms for deadlock handling

Question

What are the three major activities of an operating system in regard to memory management?

Answer

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

Question

What are the three major activities of an operating system in regard to secondary-storage management?

Answer

  1. Free-space management.
  2. Storage allocation.
  3. Disk scheduling.

Question

What are the five major activities of an operating system in regard to file management?

Answer

  1. The creation and deletion of files
  2. The creation and deletion of directories
  3. The support of primitives for manipulating files and directories
  4. The mapping of files onto secondary storage
  5. The backup of files on stable (nonvolatile) storage media

Question

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.


Question

List five services provided by an operating system. Explain how each provides convenience to the users. Explain also in which cases it would be impossible for user-level programs to provide these services.

Answer

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.
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 speci?c commands. User-level programs cannot be trusted to only access devices they should have access to, and to only access them when they are otherwise unused.
There are many details in file creation, deletion, allocation, and naming that users should not have to perform. Blocks of disk space are used by files and must be tracked. Deleting a file requires removing the name file information and freeing the allocated blocks. Protections must also be checked to assure proper file access. User programs could ensure neither adherence to protection methods nor could they be trusted to allocate only free blocks and deallocate blocks on file deletion.
Message passing between systems requires messages be turned into packets of information, sent to the network controller, transmitted across a communications medium, and reassembled by the destination system. Packet ordering and data correction must take place. Again, user programs might not coordinate access to the network device, or they may receive packets destined for other processes.
Error detection occurs at both the hardware and software levels. At the hardware level, all data transfers must be inspected to ensure that data have not been corrupted in transit. All data on media must be checked to be sure they have not changed since they were written to the media. At the software level, media must be checked for data consistency; for instance, do the number of allocated and unallocated blocks of storage match the total number on the device. There, errors are frequently process-independent (for instance, the corruption of data on a disk), so there must be a global program (the operating system) that handles all types of errors. Also, by having errors processed by the operating system, processes need not contain code to catch and correct all the errors possible on a system.

Question

What is the purpose of system calls?

Answer

System calls allow user-level processes to request services of the operating system.


Question

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 users do not need to write their own programs to solve common problems.


Question

What is the main advantage of the layered approach to system design?

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.


Question

What is the main advantage for an operating-system designer of using a virtual-machine architecture? What is the main advantage for a user?

Answer

The system is easy to debug, and security problems are easy to solve. Virtual machines also provide a good platform for operating system research since many different operating systems may run on one physical system.


Question

Why is the separation of mechanism and policy a desirable property?

Answer

Mechanism and policy must be separate to ensure that systems are easy to modify. No two system installations are the same, so each installation may want to tune the operating system to suit its needs. With mechanism and policy separate, the policy may be changed at will while the mechanism stays unchanged. This arrangement provides a more flexible system.


Question

Consider the experimental Synthesis operating system, which has an assembler incorporated within the kernel. To optimize system-call performance, the kernel assembles routines within kernel space to minimize the path the system call must take through the kernel. This approach is the antithesis of the layered approach, in which the path through the kernel is extended so that building the operating system is made easier. Discuss the pros and cons of this approach to kernel design and to system-performance optimization.

Answer

Synthesis is impressive due to the performance it achieves through on-the-fly compilation. Unfortunately, it is difficult to debug problems within the kernel due to the fluidity of the code. Also, such compilation is system specific, making Synthesis difficult to port (a new compiler must be written for each architecture).

Page last modified on 25-07-2008 (08:41)