Difference between Process and Thread SN Process Thread 1 Process is heavy

Difference between process and thread sn process

This preview shows page 12 - 15 out of 29 pages.

Difference between Process and Thread S.N. Process Thread 1 Process is heavy weight or resource intensive. Thread is light weight taking lesser resources than a process. 1 Process switching needs interaction with operating system. Thread switching does not need to interact with operating system. 1 In 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. 1 If one process is blocked then no other process can execute until the first process is unblocked. While one thread is blocked and waiting, second thread in the same task can run.
Image of page 12
1 Multiple processes without using threads use more resources. Multiple threaded processes use fewer resources. 1 In multiple processes each process operates independently of the others. One thread can read, write or change another thread's data. Advantages of Thread Thread 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 Thread Threads are implemented in following two ways User Level Threads -- User managed threads Kernel Level Threads -- Operating System managed threads acting on kernel, an operating system core. OS - Memory Management Memory 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 register specifies 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.
Image of page 13
Instructions and data to memory addresses can be done in following ways Compile 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 time Dynamic Loading In 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
Image of page 14
Image of page 15

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture