4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

17
4P13 Week 2 & 3 Talking Points 1

Transcript of 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

Page 1: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

1

4P13Week 2 & 3

Talking Points

Page 2: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

2

Kernel Processes

Page 3: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

3

Run-Time Organization

Page 4: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

4

Kernel Entry• The hardware switches into kernel (supervisor) mode, so that

memory-access checks are made with kernel privileges, references to the stack use the per-process kernel stack, and privileged instructions can be executed.

• The hardware pushes onto the per-process kernel stack the program counter, processor status longword, and information describing the type of trap. (On architectures other than the PC, this information can include the system-call number and general-purpose registers as well.)

• An assembly-language routine saves all state information not saved by the hardware. On the PC, this information includes the general-purpose registers and the user stack pointer, also saved onto the per-process kernel stack.

Page 5: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

5

• Entry can be caused by:– Syscall()– Trap()– Device interrupt

Page 6: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

6

Kernel Return

• An assembly-language routine restores the general-purpose registers and user-stack pointer previously pushed onto the stack.

• The hardware restores the program counter and program status longword, and switches to user mode, so that future references to the stack pointer use the user ’s stack pointer, privileged instructions cannot be executed, and memory-access checks are done with user-level privileges.

Page 7: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

7

HardClock()• If the currently running process has a virtual or profiling

interval timer (see Section 3.6), it decrements the timer and delivers a signal if the timer has expired.

• It increments the current time of day by the number of ticks since the previous call to hardclock().

• If the system does not have a separate clock for process profiling, the hardclock() routine does the operations normally done by profclock(), as described in the next section.

• If the system does not have a separate clock for statistics gathering, the hardclock() routine does the operations normally done by statclock(), as described in the next section.

• If softclock() needs to be run, it makes the softclock process runnable.

Page 8: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

8

Softclock()

• Is a process, which behaves like hardclock but is not time critical.

• Runs as a normal process in between hardclock interrupts.– Process real-time timer (see Section 3.6)– Retransmission of dropped network packets– Watchdog timers on peripherals that require

monitoring– System process-rescheduling events

Page 9: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

9

Call out Queue

Page 10: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

10

Page 11: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

11

Resource Utilization

• The amount of user and system time used by the process

• The memory utilization of the process• The paging and disk I/O activity of the process• The number of voluntary and involuntary

context switches taken by the process• The amount of inter-process communication

done by the process.

Page 12: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

12

Resource Limits• The maximum amount of CPU time that can be accumulated• The maximum bytes that a process can request be locked into memory• The maximum size of a process’s data segment• The maximum size of a process’s stack segment• The maximum amount of private physical memory that a process may

have at any given moment• The maximum amount of private or shared physical memory that a

process may have at any given moment• The maximum amount of physical memory that a process may have

dedicated to socket buffers• The maximum size of a file that can be created by a process• The maximum size of a core file that can be created by a process• The maximum number of simultaneous open files for a process• The maximum number of simultaneous processes allowed to a user

Page 13: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

13

Page 14: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

14

Page 15: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

15

Page 16: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

16

Page 17: 4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.

17

End