Introduction to Process and Thread for efficient computing


Process scheduling plays a major role in faster and efficient computing. In this article we would explore the basics of the same, mainly focusing on the process states and process control block. Apart from these we would also explore the meaning of thread and its relation to process.

In earlier days only one program could be run on a computer system at a given time and it would have complete access to all the resources of the system. These days its possible to load multiple programs into a given system and make them all run concurrently. For this to happen there was need of firmer control along with more compartmentalization of different programs which resulted in the concept of process i.e. a program in execution. System basically has a 2 types of processes, first the operating system processes which execute the system code and next the user processes for the user code. All the processes are run concurrently as the operating system switches the CPU between them for faster execution.

There are situations when the user may be executing a single program but the system has certain internal programs running at the same time. Both of them are processes since they are similar in activity. It is important to note that often the terms job and process are used interchangeably though they mean the same.

Process

Informally the process is considered to be a program in execution though it means a lot more than just a program code i.e. the text section. It contains information about the current state of the given program which is represented by the value of the program counter. It also contains the contents of the processors's registers, process stack which is responsible for holding the temporary data like function parameters, local variables and return addresses, data section to store the global variables. Process may also have heap which represents the memory that is dynamically allocated at run time.

Process refers to any program that is being executed by the system and the program counter points to the next instruction along with the set of associated resources. Apart from this all processes are considered to be passive entities. Such passive entities become a process when they are loaded from the secondary memory to the main memory. One important thing to note is that even if multiple instances of the same program are generated, they are considered to be separate processes e.g. a particular website is opened in different browsers, they would be treated as different processes though they all show the same content.

Process State


process_sate
Once the process gets into the main memory, it undergoes a number of transitions between the following mentioned states:

  • New State: This state means that the process has just been created i.e. it has the program has been fetched from the secondary memory and in now in the primary memory.

  • Running State: When a process is said to be in this state, it means that the process is under execution and has access to all the resources.

  • Waiting State: While a process is being executed an instruction may arise which needs the involvement of I/O device or some other program, hence the present process is sent to waiting state. The program still exists in the primary memory and waits for further execution.

  • Ready State: It refers to the situation when the given process is ready for execution and is waiting to be assigned to some processor.

  • Terminated State: This is the final state i.e. after all the instructions have been executed.

The above mentioned states can be represented by other names as well, depending on the operating system but they would always be present for the efficient functioning of a system.

Process Control Block


PCB
It is an important part of process management since each process is represented in the operating system with the help of the process control block(PCB). It is also referred to as the task control block. It contains almost all the necessary information associated with a given process.

  • Process State: This part of the PCB mentions the present state of the process i.e whether it is ready, running, waiting, halted or terminated.

  • Program Counter: This is used to indicate the address of the instruction that is to be executed next for the given process.

  • CPU Registers: There are different types of registers present in the system based on the computer architecture e.g. accumulator, index register, stack pointer, general-purpose registers etc. These are needed to store information about the process in execution while an interrupt occurs. The reason behind this is that later when the execution of the process is continued, the previous details can be fetched.

  • Information Regarding CPU-Scheduling: It stores all the information regarding the process priority, the pointers to the scheduling queues and lastly the scheduling parameters.

  • Memory-Management Information: It contains data about the base value and limit of registers, segment table and page table. All these values completely depend on the memory size used by the operating system.

  • Accounting Information: It has the data regarding the total amount of CPU and real time put to use, account number, time limit, process number etc.

  • I/O Status Information: As already mentioned, a process may need the involvement of some !/) device. Thus this table is used to hold data regarding which I/O device is allocated to which process. It also stores data regarding the list of open files

CPUswitch

Thread

It is important to understand that when a particular process is being put to execution, it means that a single thread is actually being processed. At a time, multiple threads can't be processed together e.g we cannot type in multiple characters simultaneously and run the spell check at the same time separately. New systems are coming up which a single process to have multiple threads for faster execution.


Related Articles

Best Budgeting Tips to become an efficient Manager

Are you working as a Manager of an organisation? Are you facing difficulties in planning and preparing budgets for your organisation? Read this article to know the important tips for managers on how to prepare the budget for your organisaton.

Efficient Solar Energy

Read this article to know why solar energy is efficient source of energy and is among one of the best energy sources in the world.

More articles: Efficient

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: