 Hello everyone. As we already studied context of a kernel level, today we are going to study context of a process. We in last videos we studied layout of kernel. Now, let us see what process contains when it executes. The learning outcome of these videos are at the end of this session student will be able to demonstrate context of the process. Now, what do you mean by context of a process? Context of a process means whenever process executes what it contains. So, here context of process contains three parts, user level context, register level context and system level context. User level context contains text, data, user stack and shared memory which is related with the process. While register level context consist of program counter, processor status registers, stack pointer, general purpose registers. System level context contains static part and dynamic part of the process. So, user level, register level and system level context combinedly forms the whole context of the process. Now, text data and stack are nothing but different regions of the process where text contains some set of instructions while data contains the variables which are used in the program and user stack is related with the process whenever that process is executing in user mode. Some part of the memory may be shared among multiple processes that is also the part of user level context. Now, let us see register level context. Register level context contains program counter. As we already know the program counter stores the information of the instruction which is to be executed next. Processor status register. Now, processor status registers gives machine level instructions or it gives machine level information about the process. Stack pointer. Stack pointer always points to the location, current location into the stack and stack pointer points according to user mode or kernel mode. If process is executing in user mode then stack pointer will point to the user stack. If process is executing in kernel mode then stack pointer will point to the kernel stack. General purpose registers. Now, general purpose registers are always used by process whenever it is executing. So, all these forms the register level context where different types of registers are used by the process. Now, as I already told system level context. System level context contains the information about the system which is used by the process. It contains two parts static part and dynamic part. Now, here the user level context contains process text which contains some set of instructions. It contains data. The actual data used by the process while execution. Stack. It may be either user stack or kernel stack. And shared data. Some part of the memory is shared among multiple processes. So, whatever data is shared among multiple processes it comes under the static part. This is what the user level context. This static part again contains two types that is user level and system level. So, process text data, stack and shared data are nothing but user level context. Now, system level context. System level context contains process table entry. Now, as I already told you that each and every process has an entry in process table in Unix. U area is associated with the process whenever that process is executing in kernel mode. And that U area is accessible to the only to the running processes or whenever that process is running into the kernel mode. And per process region table. Now, per process region table is associated with each and every process. Process has entry in process table but per process region table is a table which is associated with each process which contains information about the region of the process. Now region is nothing but the continuous address space, virtual address space of the process. And region maybe either text region, data region or stack region. Then which type of region that process contains that is located in per process region table. So, these are all kernel data structures. Process table, U area, per process region table all are kernel level data structures and that is why this is a system level context of the process. Now dynamic part. Static part is already defined while dynamic part is at during the execution during run time. So, dynamic part contains some set of layers visualized as last in first out manner. Now, let us pause your video and just compare what is static and dynamic part of the process. Now, as I already told static part is divided into user level and system level where it contains text data and shared data, shared memory. It contains text, it contains data and it contains some shared memory. While dynamic part contains the process table entry, U area and per region table. All these dynamic part are the kernel data structures and they get modified or they get updated in whenever that process is running in kernel mode and that is why it is a dynamic part. Now, let us see the components of context of a process in detail. Whatever I have explained just now, process context contains static part and dynamic part. Now, as shown here the static portion of the context contains again user level context and system level context where user level context contains process text data, stack and shared data while the system level context contains process table entry, U area and per process region table. Now this dynamic process table entry, U area and per process region table are also related to the dynamic portion of the context. Now, whatever shown here is nothing but the kernel stack which is part of the dynamic which is dynamic portion of the process. So, here as we can see the kernel context layer 0 contains user level, kernel context level 1 contains information about user level plus it contains information about that layer 1. So, every stack this is nothing but kernel stack. So, the stack here contains the information about the previous layer. So, this is what all about the context of a process. Now, this runs within its current context layer. So, as I told here these are different layers of the context layer 0, layer 1, layer 2, layer 3. So, processes executes within its current context layer. The number of context layer is bounded by number of interrupt levels the machine supports. So, if machine supports different interrupt levels for software interrupt, terminal disks, all other peripherals or clock then there will be different context layers. Suppose it supports 5 interrupt levels and 7 context levels then there will be total 5 plus 7 that is 12 context layer will be there for the process. Here for each and every interrupt there will be one level. For each and every system call there will be one layer means there will be one interrupt layer for interrupt level one for system call one for user level. So, here the dynamic portion of the context is shown with dot, dot, dot which says that this is in increasing order. Whenever process changes its context layer it is added in dynamic portion of the context. So, as many interrupt levels are supported by the system that many context layers will be associated with that process. So, here if we summarize this, so the number of context layer is bounded to the number of interrupt levels that the machine supports and each and every time the process runs within its current context layer. So, there are different context layers. So, there will be different layers which are present in the context of the process. So, these are the references whatever we studied it is all about the context of the process.