CS139-lecture-20210914

Structure cont #

image_2021-09-14-13-36-36

Simple structure #

image_2021-09-14-13-36-48 image_2021-09-14-13-36-53 image_2021-09-14-13-36-58

Layered structure #

image_2021-09-14-13-37-33

A 5 layered approach:

5. operator
4. user programs
3. IO management
2. communication
1. memory management
0. CPU, support for multi program

This is easier to construct and debug, however there is a communication overhead. It is impractical to divide the kernel into layers.

Microkernel structure #

image_2021-09-14-13-45-17 image_2021-09-14-13-46-06

Microkernels are easier to extend, but there is a lot of communication overhead. This also doesn’t support a hot patch, if we had another feature we have to recompile the kernel.

Modular kernel #

image_2021-09-14-13-48-56 image_2021-09-14-13-49-06

  • More flexible than the layered
  • More efficient than the microkernel

Processes #

File: 139-processes.pdf

image_2021-09-14-13-53-35

Programs

  • passive, on disk

Process

  • active, in memory
  • one of several states

One program can be executed by multiple processes.

Processes in memory #

image_2021-09-14-13-56-53 image_2021-09-14-13-59-25

Looking at processes #

image_2021-09-14-14-03-53

Process states #

image_2021-09-14-14-05-02

Note: “Waiting time” is the time spent in ready state.

image_2021-09-14-14-05-46

This 5 state model is what we’ll use in this class.

What causes the interrupt transition: running > ready?

  • the OS

What causes the scheduler dispatch transition: ready > running?

  • the OS

What causes the IO or event wait transition: running > waiting?

  • the process itself

What causes the IO or event completion transition: waiting > ready?

  • an external process

Process Control Block (PCB) #

image_2021-09-14-14-26-52

Process number = PID

Scheduling #

image_2021-09-14-14-35-39