Difference between Process and ThreadS.N.ProcessThread1Process is heavy weight or resource intensive.Thread is light weight taking lesser resources than a process.1Process switching needs interaction with operating system.Thread switching does not need to interact with operating system.1In multiple processing environments each process executes the same code but has its own memory and file resources.All threads can share same set of open files, child processes.1If one process is blocked then no other process can execute until the first process is unblocked.While one thread is blocked and waiting, secondthread in the same task can run.
1Multiple processes without using threads use more resources.Multiple threaded processes use fewer resources.1In multiple processes each process operatesindependently of the others.One thread can read, write or change another thread's data.Advantages of ThreadThread minimize context switching time.Use of threads provides concurrency within a process.Efficient communication.Economy- It is more economical to create and context switch threads.Utilization of multiprocessor architectures to a greater scale and efficiency.Types of ThreadThreads are implemented in following two waysUser Level Threads-- User managed threadsKernel Level Threads-- Operating System managed threads acting on kernel, an operating system core.OS - Memory ManagementMemory management is the functionality of an operating system which handles or manages primary memory. Memory management keeps track of each and every memory location either it is allocated to some process or it is free. It checks how much memory is to be allocated to processes. It decides which process will get memory at what time. It tracks whenever some memory gets freed or unallocated and correspondingly it updates the status. Memory management provides protection by using two registers, a base register and a limit register. The base register holds the smallest legal physical memory address and the limit registerspecifies the size of the range. For example, if the base register holds 300000 and the limit register is 1209000, then the program can legally access all addresses from 300000 through 419999.
Instructions and data to memory addresses can be done in following waysCompile time-- When it is known at compile time where the process will reside, compile time binding is used to generate the absolute code.Load time-- When it is not known at compile time where the process will reside in memory, then the compiler generates re-locatable code.Execution time-- If the process can be moved during its execution from one memory segment to another, then binding must be delayed to be done at run timeDynamic LoadingIn dynamic loading, a routine of a program is not loaded until it is called by the program. All routines are kept on disk in a re-locatable load format. The main program is loaded into memory and is executed. Other routines methods or modules are loaded on request. Dynamic loading