Lecture 4: more process state, threads, show and tell, scheduling

PCB contents

Previously, we talked about the PCB holding the registers (including CPU flags and base/limit registers). The OS may want to associate other state with each process as well:

Doing useful things while you wait

We introduced interrupts because the processor may want to do other useful work while waiting for I/O.

Processes may also want to do other useful work while waiting for I/O (instead of yielding to a different process). There are several features that operating systems provide to enable this.

Show and tell

We used some Linux tools to explore processes and system calls. You are enouraged to play with these on your own, and to look into the Linux system calls (or system calls for your favorite operating system).

We noted some interesting facts about the linux system call interface:

Scheduling

Thus far when discussing time-sharing between processes, we've simply said that when it is time to switch processes, the operating system selects a new process and then runs it. The details of "when it is time" and which process to select can have major impacts on system behavior.

We would like a scheduler that satisfies the following criteria:

We discussed the following algorithms: - First-come, first-served (FCFS): whenever a process becomes ready, it is placed at the tail of a queue. Whenever a process relinquishes the CPU, a new process is taken from the head of the queue and scheduled. - Pros: simple, fair (no process starves). - Cons: I/O bound and CPU/bound processes are treated the same, so waiting time, responsiveness, priority and predictability can be poor.