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 2
3. 4 Process Control 3. 4.1 Modes of execution 3.4.2 Process creation 3.4.3 Process Switching
3.4 Process Control • 3.4.1 Modes of Execution • 3.4.2 Process Creation • 3.4.3 Process Switching 3
3.4.1 Modes of Execution(1/ 1) User mode Less-privileged mode User programs typically execute in this mode System mode, control mode, or kernel mode More-privileged mode Kernel of the operating system Translation between the two model Processor status register(psr) and current privileged level(cpl User mode-> System mode System mode->User mode
3.4.1 Modes of Execution(1/1) • User mode • Less-privileged mode • User programs typically execute in this mode • System mode, control mode, or kernel mode • More-privileged mode • Kernel of the operating system • Translation between the two model • Processor status register (psr) and current privileged level (cpl) • User mode->System mode • System mode->User mode 4
3. 4 Process Control 3. 4.1 Modes of execution 3.4.2 Process creation 3.4.3 Process Switching 3.4.4 Execution of the Operating System
3.4 Process Control • 3.4.1 Modes of Execution • 3.4.2 Process Creation • 3.4.3 Process Switching • 3.4.4 Execution of the Operating System 5
3.4.2 Process Creation( 1/3) Assign a unique process identifier Allocate space for the process Initialize process control block Set up appropriate linkages Ex:add new process to linked list used for scheduling queue Create of expand other data structures Ex: maintain an accounting file
3.4.2 Process Creation(1/3) • Assign a unique process identifier • Allocate space for the process • Initialize process control block • Set up appropriate linkages • Ex: add new process to linked list used for scheduling queue • Create of expand other data structures • Ex: maintain an accounting file 6
3.4.2 Process Creation( 2/ 3) Process tree for a Linux system Processes may create other processes through appropriate system calls, such as fork Init is the root/parent of all processes executing on inux except process o slgubuntu: -S pstree letworkManager-rdhclient Pd=3028 GAuthService accounts-daemon-Tfgdbus] Remain getty anacron apt systemd. dai--apt. systemd, dai-apt - get *[http] tore olord-Tigdbus] Domain pid=9204
3.4.2 Process Creation(2/3) • Process tree for a Linux system • Processes may create other processes through appropriate system calls, such as fork • Init is the root/parent of all processes executing on Linux except process 0. 7
3.4.2 Process Creation(3/3) Linux startup process The init process is the last step in the boot procedure ON POWER UP BIOS his is your GRUB or LILO, where you choose the Os you want to start. BOOT LOADER KERNEL SPACE Your os kernel loads its extensions the device drivers(but not only. KERNEL LOADING USERLAND The first process: runs on-boot processes and manage all processes INIT SYSTEM until shutdown
3.4.2 Process Creation(3/3) 8 • Linux startup process • The init process is the last step in the boot procedure
3. 4 Process Control 3. 4.1 Modes of execution 3.4.2 Process creation .3. 4.3 Process Switching
3.4 Process Control • 3.4.1 Modes of Execution • 3.4.2 Process Creation • 3.4.3 Process Switching 9
3. 4.3 Process Switching( 1/3) process Po operating system process interrupt or system call executing save state into PCBo idle reload state from PCB idle interrupt or system call executing save state into PCB1 dle reload state from PCBo ecuting 10
3.4.3 Process Switching(1/3) 10
3. 4.3 Process Switching( 2/3) Mode switching User Mode->Kernel Mode 1. Interrupt Clock interrupt: process has executed for the maximum allowable time slice ·I/ O interrupt Memory fault: Referenced virtual address is not in main memory, so it must be brought in 2. Trap error or exception occurred, may cause process to be moved to exit state 3. Supervisor call (System Call such as file open
3.4.3 Process Switching(2/3) • Mode Switching: User Mode -> Kernel Mode • 1. Interrupt • Clock interrupt: process has executed for the maximum allowable time slice • I/O interrupt • Memory fault: Referenced virtual address is not in main memory, so it must be brought in. 2. Trap • error or exception occurred, may cause process to be moved to Exit state 3. Supervisor call (System Call) • such as file open 11