process Po operating system process P interrupt or system call executing save state into PCBo 。 idle reload state from PCB; -idle interrupt or system call executing save state into PCB, idle reload state from PCB。 executing
PCB in Linux pid-t pid;/process identifier * long state;/state of the process * unsigned int time_slice /scheduling information * struct task-struct *parent;/this process's parent * struct list head children;/this process's children * struct files_struct *files;/list of open files * struct mm-struct *mm;/address space of this process * struct task struct struct task_struct struct task struct process information process information process information current->state new.state; ↑ 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 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
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 I/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