Search More:-

Saturday, 19 November 2011

Process Control Block (PCB)


A process in an operating system is representing by a data structure known as a process control block (PCB) or process descriptor. 

The PCB contain important information about the specific process include:-
  • The current state of the process i.e., whether it is ready, running, waiting, or whatever.
  • Unique identification of the process in arrange to track "which is which" information.
  • A pointer to parent process.
  • Similarly, a stick to child process (if it exists).
  • The priority of process (a part of CPU scheduling information).
  • Pointers to place memory of processes.
  • A register save area.
  • The processor it is running on.

The PCB is a certain store that allow the operating systems to locate key information about a process. Thus, the PCB is the data structure that define a process to the operating systems.

Preemptive Vs Non preemptive Scheduling


The Scheduling algorithms can be divided into two category with respect to how they contract with clock interrupt:-

Non preemptive Scheduling:- 
A scheduling regulation is non preemptive if, once a process has been given the CPU, the CPU cannot be taken away from that process.

Following are some characteristics of non preemptive scheduling:-
  • In non preemptive system, short jobs are made to wait by longer jobs but the overall action of all processes is fair.
  • In non preemptive system, response times are extra predictable because incoming high priority jobs can not displace waiting jobs.
  • In non preemptive scheduling, a scheduler executes jobs in the follow two situations.
  • When a process switches from running state to the waiting state.
  • When a process terminate. 

Preemptive Scheduling:-
A scheduling regulation is preemptive if, once a process has been given the CPU can taken away.

The plan of allowing processes that are logically run-able to be temporarily balanced is called Preemptive Scheduling and it is contrast to the "run to completion" method.

Scheduling Algorithms

CPU Scheduling deal with the difficulty of deciding which of the processes in the prepared queue is to be allocated the CPU.


Following are some scheduling algorithms:-
  • FCFS Scheduling.
  • Round Robin Scheduling.
  • SJF Scheduling.
  • SRT Scheduling.
  • Priority Scheduling.
  • Multilevel Queue Scheduling.
  • Multilevel Feedback Queue Scheduling.

Threads

Despite of the information that a thread must carry out in process, the process and its linked threads are diverse concept. Processes are accustomed to group resources jointly and threads are the entities scheduled for carrying out on the CPU.

A thread is a single series stream within in a process. Because threads have a few of the properties of processes, they are at times known as lightweight processes. In a process, threads permit many executions of streams. In lots of respect, threads are admired way to improve application through parallelism. The CPU switches quickly back and forth among the threads giving false impression that the threads are running in parallel.

Advantages of Threads over Multiple Processes:-


Context Switching:- Threads are very inexpensive to make and obliterate, and they are inexpensive to represent. For example, they need space to store, the PC, the SP, and the general-purpose register, but they do not need space to share memory information, Information about open files of I/O devices in use, etc. With so small context, it is much quicker to switch between threads. In extra words, it is comparatively easier for a context switch using threads.

Sharing:-  Treads permit the sharing of a lot resources that cannot be shared in process, for example, sharing code section, information section, Operating System resources like open file etc.

Disadvantages of Threads over Multiple Processes:-

Blocking:- The main disadvantage if that if the kernel is single threaded, a system call of one thread will block the whole process and CPU may be idle during the blocking time.

Security:- Since there is, an general sharing among threads there is a potential difficulty of security. It is quite possible that one thread over write the stack of another thread (or damaged shared data) although it is very not likely since threads are meant to cooperate on a single task.

Kernels

The kernel is the trust branch of the operating system. It runs in the administrator mode.

The trap device instruction is accustomed to switch from user mode to the supervisor mode. It is hardened to implement system calls. A substitute to trap is using messages to obtain service from the operating system.

Operating System (OS) Book