Αρχική ΑΕΠΠ - Δομές Δεδομένων Λειτουργικά Συστήματα Δίκτυα Υπολογιστών ΙΙ Βάσεις Δεδομένων Παιδαγωγικά - Διδακτική

Εισαγωγικά

Εισαγωγή στα Λ.Σ. Βασικές Δομές Η/Υ Βασικές Δομές Λ.Σ

Διεργασίες

Διεργασίες Χρονοπρογραμματισμός Συγχρονισμός

Αδιέξοδα

Μνήμη

Μονοπρογραμματισμός Εναλλαγή Εικονική Μνήμη Κατάτμηση

Είσοδος / Έξοδος

Σύστημα Αρχείων

Διεπαφή Υλοποίηση

 Ιστορικό Πρόσφατες αλλαγές Εκτύπωση Αναζήτηση

Βασικές Δομές Η/Υ

In Computer Systems Structure we discusses the general structure of computer systems. It may be a good idea to review the basic concepts of machine organization and assembly language programming. The students should be comfortable with the concepts of memory, CPU, registers, I/O, interrupts, instructions, and the instruction execution cycle. Since the operating system is the interface between the hardware and user programs, a good understanding of operating systems requires an understanding of both hardware and programs.


Question

How is an interrupt executed?

Answer

The I/O driver sends a signal through a special interrupt line to the CPU when it has finished with an I/O request.


Question

What is an interrupt vector?

Answer

A list giving the starting addresses of each interrupt service routine.


Question

In what ways do systems treat slow and fast devices differently?

Answer

For slow devices, each character transferred causes an interrupt. For fast devices, each block of characters transferred causes an interrupt.


Question

What is DMA?

Answer

Direct Memory Access (DMA) allows transfers of blocks of data between memory and I/O devices without intervention of the CPU, by making the transfers in between CPU instruction executions (called “interleaving”).


Question

List some special problems a programmer must concern himself with while writing I/O routines with buffers.

Answer

Can’t allow interrupt to occur while moving a record into or out of a buffer. Can’t transfer data into a filled buffer. Can’t transfer data out of an empty buffer.


Question

List operations that the monitor considers illegal, and describe why each must be considered illegal.

Answer

  1. Programming errors, such as illegal instruction, addressing fault.
  2. Job reads cards for next users’ jobs reading control cards; or else one job will interfere with the next.
  3. Halting the computer.
  4. Masking the interrupt so that none can occur. Turning on interrupts; or else job will interfere with I/O.
  5. Changing mode from user to system; or else user can control system.
  6. Using memory outside user area; invasion of privacy.
  7. Modifying interrupt vectors in monitor; could crash system.
  8. Accessing monitor memory; invasion of privacy.

Question

What resources must be protected by the operating system?

Answer

I/O, the monitor, memory, CPU


Question

Describe the magnetic properties of disks.

Answer

Disks are flat circular-shaped platters with magnetic material on both surfaces. They have concentric tracks where information is stored. Each track is divided up into sectors. The disks spin to allow read/write heads to access each part, typically 5 rev/sec for coppies to 60 rev/sec for hard disks.


Question

List kinds of disks.

Answer

  1. Fixed head disk: has one read/write head for each track.
  2. Moving head disk: one read/write head per surface; it moves back and forth to access the various tracks.
  3. Multiplatter disks: several disks in one cover, all driven by the same motor.
  4. Removable cartridge: allows disks to be swapped.
  5. Hard disks: uses rigid aluminum platters covered with magnetic material.
  6. Floppy disks: uses flexible material like in Time-Life sample records, encased in cardboard.
  7. RAM disks: not really a disk; semiconductor memory set up to emulate a disk.

Question

What is a sector? track?

Answer

Sector — smallest block that can be read or written on a disk. Track — collection of sectors all on same circumference on a single surface.


Question

What is a disk controller?

Answer

A separate board installed in the computer chassis to control and interact with each disk drive attached to it.


Question

What is a drum?

Answer

Effectively, a single disk with only one cylinder. It is a cylinder-shaped box that revolves on its axis, with the read/write surface around the circumference, with many tracks all of the same radius.


Question

How does the operating system determine what mode it is in?

Answer

One bit gives the present state — the monitor/user-mode bit.


Question

List ways a user can take control of a system if memory is not protected.

Answer

  1. Alter an interrupt vector entry to point to his own program area. This would give him control of the system while system is in monitor mode.
  2. Alter part of the interrupt service routine to jump to his program, again giving him privileged access to all instructions.

Question

How can we prevent users from accessing other users’ programs and data?

Answer

Introduce base and limit registers that hold the smallest legal physical memory address, and the size of the range, respectively. As a user’s job is started, the operating system loads these registers; if the program goes beyond these addresses, it is aborted. If another job starts up, these registers are reset for the new job.


Question

How can the operating system detect an infinite loop in a program?

Answer

A timer (hardware) is added to system. Each user is allowed some predetermined time of execution (not all users are given same amount). If user exceeds these time limits, the program is aborted via an interrupt.


Question

List some categories of privileged instructions.

Answer

  1. I/O
  2. Modifying base and limit registers
  3. Modifying timer
  4. Halt
  5. Turning interrupt enable off
  6. Changing monitor/user-mode bit

Question

Prefetching is a method of overlapping the I/O of a job with that job’s own computation. The idea is simple. After a read operation completes and the job is about to start operating on the data, the input device is instructed to begin the next read immediately. The CPU and input device are then both busy. With luck, by the time that the job is ready for the next data item, the input device will have ?nished reading that data item. The CPU can then begin processing the newly read data, while the input device starts to read the following data. A similar idea can be used for output. In this case, the job creates data that are put into a buffer until an output device can accept them. Compare the prefetching scheme with the spooling scheme, where the CPU overlaps the input of one job with the computation and output of other jobs.

Answer

Prefetching is a user-based activity, while spooling is a system-based activity. Spooling is a much more effective way of overlapping I/O and CPU operations.


Question

How does the distinction between monitor mode and user mode function as a rudimentary form of protection (security) system?

Answer

By establishing a set of privileged instructions that can be executed only when in the monitor mode, the operating system is assured of controlling the entire system at all times.


Question

What are the differences between a trap and an interrupt? What is the use of each function?

Answer

An interrupt is a hardware-generated change-of-?ow within the system. An interrupt handler is summoned to deal with the cause of the interrupt; control is then returned to the interrupted context and instruction. A trap is a software-generated interrupt. An interrupt can be used to signal the completion of an I/O to obviate the need for device polling. A trap can be used to call operating system routines or to catch arithmetic errors.


Question

For what types of operations is DMA useful? Explain your answer.

Answer

DMA is useful for transferring large quantities of data between memory and devices. It eliminates the need for the CPU to be involved in the transfer, allowing the transfer to complete more quickly and the CPU to perform other tasks concurrently.


Question

Which of the following instructions should be privileged?

  1. Set value of timer.
  2. Read the clock.
  3. Clear memory.
  4. Turn off interrupts.
  5. Switch from user to monitor mode.

Answer

The following instructions should be privileged:

  1. Set value of timer.
  2. Clear memory.
  3. Turn off interrupts.
  4. Switch from user to monitor mode.

Question

Some computer systems do not provide a privileged mode of operation in hardware. Consider whether it is possible to construct a secure operating system for these computers. Give arguments both that it is and that it is not possible.

Answer

An operating system for a machine of this type would need to remain in control (or monitor mode) at all times. This could be accomplished by two methods:

  1. Software interpretation of all user programs (like some BASIC, APL,and LISP systems, for example). The software interpreter would provide, in software, what the hardware does not provide.
  2. Require that all programs be written in high-level languages so that all object code is compiler-produced. The compiler would generate (either in-line or by function calls) the protection checks that the hardware is missing.

Question

Some early computers protected the operating system by placing it in a memory partition that could not be modified by either the user job or the operating system itself. Describe two difficulties that you think could arise with such a scheme.

Answer

The data required by the operating system (passwords, access controls, accounting information, and so on) would have to be stored in or passed through unprotected memory and thus be accessible to unauthorized users.


Question

Protecting the operating system is crucial to ensuring that the computer system operates correctly. Provision of this protection is the reason behind dual-mode operation, memory protection, and the timer. To allow maximum flexibility, however, we would also like to place minimal constraints on the user. The following is a list of operations that are normally protected. What is the minimal set of instructions that must be protected?

  1. Change to user mode.
  2. Change to monitor mode.
  3. Read from monitor memory.
  4. Write into monitor memory.
  5. Fetch an instruction from monitor memory.
  6. Turn on timer interrupt.
  7. Turn off timer interrupt.

Answer

The minimal set of instructions that must be protected are:

  1. Change to monitor mode.
  2. Read from monitor memory.
  3. Write into monitor memory.
  4. Turn off timer interrupt.

Question

When are caches useful? What problems do they solve? What problems do they cause? If a cache can be made as large as the device for which it is caching (for instance, a cache as large as a disk), why not make it that large and eliminate the device?

Answer

Caches are useful when two or more components need to exchange data, and the components perform transfers at differing speeds. Cahces solve the transfer problem by providing a buffer of intermediate speed between the components. If the fast device ?nds the data it needs in the cache, it need not wait for the slower device. The data in the cache must be kept consistent with the data in the components. If a component has a data value change, and the datum is also in the cache, the cache must also be updated. This is especially a problem on multiprocessor systems where more than one process may be accessing a datum. A component may be eliminated by an equal-sized cache, but only if: a) the cache and the component have equivalent state-saving capacity (that is, if the component retains its data when electricity is removed, the cache must retain data as well), and b) the cache is affordable, because faster storage tends to be more expensive.


Question

Writing an operating system that can operate without interference from malicious or un-debugged user programs requires some hardware assistance. Name three hardware aids for writing an operating system, and describe how they could be used together to protect the operating system.

Answer

  1. Monitor/user mode
  2. Privileged instructions
  3. Timer
  4. Memory protection

Τελευταία ενημέρωση: 26-08-2008 (08:33)

Copyright 2008 - Άρης Φεργάδης