 Hello everyone, today we are going to learn about layout of system memory where we are going to learn about necessity of address translation and what is region. The learning outcome of this session are student will be able to define necessity of address translation and differentiate between types of regions. Let us assume that physical memory of machine is addressable which starts at byte offset 0 and goes up to the maximum memory of the system. That means it is equal to the memory present in the system. As we already know that process consists of three logical sections recall that process is nothing but program in execution. So whenever that program is in execution state it becomes a process and it consists of three logical sections that is text, data and stack. The text section contains set of instructions that the machine executes for the process. Text section contains some addresses. The addresses in the text section are text address which contains address for branch instruction or subroutine call means if your program contains some branch instruction or some function call then the address of such functions are stored in text address field. It contains data addresses. The data addresses contains address for the access to global data variable if exist in the program and stack address contains the address for access to data structures which are local to a subroutine. Now subroutine is nothing but a function call. The stack address contains the address of the data structures means whatever data structures you are going to use in your program within that function. The address of that data structures is stored in stack for example if you have an array or structure in your program then address required for that array and data structure is stored in a stack address of the text section. Now let us consider that if machine treats the generated address as address locations in physical memory means what if compiler generates an address and that address is directly located into physical memory means machine considers that the address generated by compiler will directly go to the physical memory address but if such thing happens then it is impossible for two processes to execute concurrently in the system because the set of generated address may get overlap for two processes. So the compiler may try to generate different address for different programs such that that generated address do not get overlap but this is not practically possible because implementation of this is inflexible and undesirable as we have finite number of memory finite memory present in the system and the number of processes which are going to be compile are infinite. So generating different addresses for different program is not possible practically and that is why compiler needed to generate the virtual address space and this virtual address space is nothing but a region for the process. So the address generated by compiler that is virtual address space the memory management unit translates this virtual address generated by compiler into the address location in physical memory. Now just remind that the address generated by compiler is logical address or it is virtual address that address is converted into physical memory now address in physical memory is nothing but a physical address which is located in main memory while address generated by compiler is a logical or virtual address and it is that address is generated at the time of compilation of a program and this address translation is done at the time of loading of the program. So compiler does not have to know where in memory the kernel will later load the program for execution. So several copies of a program can coexist in memory all program execute using same virtual addresses but refer to different physical address means what if we have multiple copies of program which exist in the system that program may have same virtual address but they will refer to different physical address present in the system. So virtual address is a different thing and physical address is a different thing memory management unit has to translate this virtual address into the physical address. Now just think that why there is a need to translate virtual address to physical address pause the video and write your answer. Let us consider as I already explained that if machine creates the generated address as a direct address in physical memory then it is not possible for two processes to execute simultaneously in the system because their address generated address may get overlapped then compiler may try to generate different address for different program in such a way that that address do not get overlapped but this is not possible practically as implementation of generating different address for different program is inflexible and undesirable we have finite memory present in the system while the number of programs which gets compile is infinite. So that is why compiler has to generate virtual address and that virtual address must get converted into physical address by memory management unit. Now let us see about regions as I already told you region is nothing but contiguous virtual address space of a process it is contiguous virtual address space of a process. So here we will consider system V in system V kernel divides that virtual address space of a process in two logical regions. Now that region can be shared or protected and as we already know that process is associated with three types of regions that is text, data and stack okay. Now let us see the data structure used by the process during its execution now as we already know U area has pointer to the process table. The process table is associated for each process per process region table is also associated for all processes present in the system. Now as shown here this p region per process region table is also called as p region. p region entry may exist in process table means what the process table points to p region means it contains an entry which points to the p region table. Then this p region table points to the region table and contains the here as we can see this p region table points to the region table where this region table contains the virtual address of the region in the process. So region table contains virtual address that virtual address gets translated into physical address by memory management unit and then that address is located in main memory that is physical memory. So region table it just not contain only virtual address but it also contains which type of region it is whether it is text whether it is data or whether it is stack which type of region is there whether that region is shared or protected all information of that region is stored in region table along with virtual address that virtual address is converted into physical address and then it is located into the main memory. Along with this p region also contains permission field. Now this permission field is nothing but it gives the information that which type of permission is set by the process for this region whether it is read only whether it is read write or whether it is read execute which type of permission is allowed by the process for this region is set in permission field in p region table. So every process has access to its region via process table p region and region table. So all these data structures are used by the process when it wish to access its region whether it is text data or stack. So here though virtual address of the process are same they may differ physical address though the physical address is same there may be different virtual addresses. Now let us see example of this. Now let us see how the processes are related with the region. Now consider here we have two processes process A and process B process all these two processes have text data and stack region along with its p region table what this p region table contains it contains virtual address of each region of that process. So virtual address 8k, 16k, 32k for text data and stack region of process A respectively similarly 4k, 8k and 32k for text data and stack region for process B respectively. Now as shown here we can say that the text region is shared among process A and process B because they access same region that is region A. But if we see the virtual address of process A for text region is 8k and virtual address for process B for text region is 4k means their virtual addresses are different but they points to same region present in the physical memory because text region is shared among these two processes. But the data and stack regions are private for the process as shown here the data region for process A is B whose virtual address is 16k and data region for process B is E whose virtual address is 8k. Similarly the stack region for process A is C whose virtual address is 32k stack region for process B is D whose virtual address is 32k. Now again we can see here the virtual address of both for stack region is 32k which is same but the region they are using is different means they may have different physical address though they have same virtual addresses. So this is all about the process how that process related with the region and why there is a need for translation of this virtual address into the physical address these are the references thank you.