CS139-lecture-20210909

Organization cont #

Interrupts cont #

image_2021-09-09-13-43-00 image_2021-09-09-13-39-38 image_2021-09-09-13-39-51

During a IO request:

  1. Device driver loads the registers in the device controller
  2. Device controller examines content
  3. Device controller starts the transfer of data
  4. Once the transfer is done, the device controller informs the operating system that the transfer is complete.
  5. Driver gives control back to the OS

image_2021-09-09-13-48-53

Handling interrupts #

When calling a interrupt routine, we have 2 methods:

Method 1:

  1. Invoke a generic routine
  2. Call the interrupt specific routine

Method 2:

  • A table of pointers to interrupt routines
  1. Invoke the specific interrupt routine from the table, constant time

image_2021-09-09-13-52-25

When we poll the device, we can tell whether the status is busy or ready. The status register is read over an over until the busy bit is turned on. However, this wastes a CPU cycle each time we have to read this register.

So, vectored interrupts are the answer.

image_2021-09-09-13-54-13 image_2021-09-09-13-55-33 image_2021-09-09-13-57-34

Operating system operations #

image_2021-09-09-13-59-41 image_2021-09-09-14-00-10

In user mode, only non-privileged instructions can be used. In kernal mode, both non-privileged and privileged instructions can be used.

image_2021-09-09-14-03-00

System calls #

image_2021-09-09-14-06-29 image_2021-09-09-14-10-07 image_2021-09-09-14-11-24 image_2021-09-09-14-12-18 image_2021-09-09-14-12-43 image_2021-09-09-14-15-18 image_2021-09-09-14-16-02 image_2021-09-09-14-21-48 image_2021-09-09-14-22-22 image_2021-09-09-14-22-47

In most operating systems, devices are treated like files.

image_2021-09-09-14-24-36

Storage device hierarchy #

image_2021-09-09-14-25-05

  • the higher the level, the faster the speed
  • the lower the level, the bigger the capacity

The CPU cannot read anything directly below the main memory level.

image_2021-09-09-14-36-39

Structure #

image_2021-09-09-14-37-28 image_2021-09-09-14-38-24 image_2021-09-09-14-39-23 image_2021-09-09-14-39-49 image_2021-09-09-14-43-11

The layered ring structure was adopted by MULTICS.