3. 4.3 Process Switching( 3/3) Steps involved in a full process switch 1. Save context of processor including program counter and other registers change the process's state that is currently in the y 2. Update the process control block of the process a Running state 3. Move process control block to appropriate queue ready b y locked; ready/suspend 4. Select another process for execution 5. Update the process control block of the process selected and change it state 6. Update memory-management data structures 7. Restore context of the selected process
3.4.3 Process Switching(3/3) • Steps involved in a full process switch 1. Save context of processor including program counter and other registers 2. Update the process control block of the process and change the process's state that is currently in the Running state 3. Move process control block to appropriate queue – ready; blocked; ready/suspend 4. Select another process for execution 5. Update the process control block of the process selected and change it state 6. Update memory-management data structures 7. Restore context of the selected process 12 12
Chap3 Process description and control ·3.1 What is a process 3.2 Process states 3.3 Process description ·3.4 Process contro .3.5 Execution of the operating system 3.6 Unix SVR4 Process Management 3.7 Linux Process management system calls
Chap3 Process Description and Control • 3.1 What is a Process • 3.2 Process States • 3.3 Process Description • 3.4 Process Control • 3.5 Execution of the Operating System • 3.6 Unix SVR4 Process Management • 3.7 Linux Process management system calls 13
3.5 Execution of the os(1/4) 1. Nonprocess Kerne(无进程的内核) Execute kernel outside of any process Operating system code is executed as a separate entity that operates in privileged mode Common on many older oss P P 2 P n Kernel (a) Separate kernel
3.5 Execution of the OS(1/4) • 1. Nonprocess Kernel(无进程的内核) • Execute kernel outside of any process • Operating system code is executed as a separate entity that operates in privileged mode • Common on many older OSs 14
3.5 Execution of the os(2/4) 2. Execution within user processes(在用户进程中 执行) Operating system software within context of a user process Process executes in privileged mode when executing operating system code 2 n OS unc- unc- unc- nons ne Process Switching functions (b)Os functions execute within user processes
3.5 Execution of the OS(2/4) • 2. Execution Within User Processes(在用户进程中 执行) • Operating system software within context of a user process • Process executes in privileged mode when executing operating system code 15
3.5 Execution of the os(3/4) Process Identification Processor State Process Control Information Block Process Control Information User stack Private User Address space (Programs, Data) Kernel Stack Shared Address Figure 3.16 Process Image: Operating System Executes Within User Space
3.5 Execution of the OS(3/4) 16