process Po operating system process P interrupt or system call executing save state into PCBo reload state from PCB interrupt or system call executing save state into PCB reload state from PCB. executing
PCB in linux pid.t pid; /*process identifier * ong state; / state of the process * unsigned int time slice /* scheduling information * struct task struct *parent; / this process's parent * struct list head children; / this processs children * struct files.struct *files; / list of open files * struct mmstruct *mm; / address space of this process * struct task struct struct task struct struct task struct process information process information process information current->state s newstate 人// current (currently executing proccess) Figure 3.5 Active processes in Linux
PCB in Linux
Threads Modern systems allow a single process to have multiple threads of execution, which execute concurrently. especially beneficial on multicore systems, where multiple threads can run in parallel) Consider having multiple program counters per process Multiple locations can execute at once Multiple threads of control-> threads, TCB Threads are covered extensively in the next chapter
- Threads • Modern systems allow a single process to have multiple threads of execution, which execute concurrently. (especially beneficial on multicore systems, where multiple threads can run in parallel) • Consider having multiple program counters per process • Multiple locations can execute at once • Multiple threads of control -> threads, TCB • Threads are covered extensively in the next chapter
Process scheduling The two main objectives of the process scheduling system keep the cpu busy at all times deliver acceptable"response times for all programs, particularly for nteractive ones The process scheduler must meet these objectives by implementing suitable policies for swapping processes in and out of the cpu selects among available ready processes for next execution on CPU
Process Scheduling • The two main objectives of the process scheduling system • keep the CPU busy at all times • deliver "acceptable" response times for all programs, particularly for interactive ones. • The process scheduler must meet these objectives by implementing suitable policies for swapping processes in and out of the CPU. • selects among available READY processes for next execution on CPU
Scheduling queues Maintains scheduling queues of processes Job queue-set of all processes in the system Ready queue -set of all processes residing in main memory, ready and waiting to execute Device queues -set of processes waiting for an l o device Processes migrate among the various queues
- Scheduling Queues • Maintains scheduling queues of processes • Job queue – set of all processes in the system • Ready queue – set of all processes residing in main memory, ready and waiting to execute • Device queues – set of processes waiting for an I/O device • Processes migrate among the various queues